Add post excerpt to events and combine overview section
This commit is contained in:
@@ -44,6 +44,16 @@ function sp_body_class( $classes ) {
|
|||||||
$classes[] = 'sportspress-page';
|
$classes[] = 'sportspress-page';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( 'sp_event' == get_post_type() ) {
|
||||||
|
$id = get_the_ID();
|
||||||
|
if ( get_option( 'sportspress_event_show_maps', 'yes' ) == 'yes' && get_the_terms( $id, 'sp_venue' ) ) {
|
||||||
|
$classes[] = 'sp-has-venue';
|
||||||
|
}
|
||||||
|
if ( 'results' == sp_get_status( $id ) ) {
|
||||||
|
$classes[] = 'sp-has-results';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return array_unique( $classes );
|
return array_unique( $classes );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,6 +78,22 @@ if ( ! function_exists( 'sportspress_taxonomy_archive_description' ) ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Single Post ********************************************************/
|
||||||
|
|
||||||
|
if ( ! function_exists( 'sportspress_output_post_excerpt' ) ) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output the post excerpt.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @subpackage Excerpt
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function sportspress_output_post_excerpt() {
|
||||||
|
sp_get_template( 'post-excerpt.php' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Single Event ********************************************************/
|
/** Single Event ********************************************************/
|
||||||
|
|
||||||
if ( ! function_exists( 'sportspress_output_event_logos' ) ) {
|
if ( ! function_exists( 'sportspress_output_event_logos' ) ) {
|
||||||
@@ -123,6 +149,19 @@ if ( ! function_exists( 'sportspress_output_event_details' ) ) {
|
|||||||
sp_get_template( 'event-details.php' );
|
sp_get_template( 'event-details.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( ! function_exists( 'sportspress_output_event_overview' ) ) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output the event details, venue, and results.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @subpackage Event/Overview
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function sportspress_output_event_overview() {
|
||||||
|
sp_get_template( 'event-overview.php' );
|
||||||
|
}
|
||||||
|
}
|
||||||
if ( ! function_exists( 'sportspress_output_event_venue' ) ) {
|
if ( ! function_exists( 'sportspress_output_event_venue' ) ) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -25,24 +25,33 @@ add_action( 'get_the_generator_xhtml', 'sp_generator_tag', 10, 2 );
|
|||||||
/**
|
/**
|
||||||
* Before Single Event
|
* Before Single Event
|
||||||
* @see sportspress_output_event_logos()
|
* @see sportspress_output_event_logos()
|
||||||
|
* @see sportspress_output_post_excerpt()
|
||||||
*/
|
*/
|
||||||
add_action( 'sportspress_before_single_event', 'sportspress_output_event_logos', 10 );
|
add_action( 'sportspress_before_single_event', 'sportspress_output_event_logos', 10 );
|
||||||
|
add_action( 'sportspress_before_single_event', 'sportspress_output_post_excerpt', 20 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Single Event Content
|
* Single Event Content
|
||||||
*
|
*
|
||||||
* @see sportspress_output_event_video()
|
* @see sportspress_output_event_video()
|
||||||
* @see sportspress_output_event_results()
|
* @see sportspress_output_event_overview()
|
||||||
* @see sportspress_output_event_details()
|
|
||||||
* @see sportspress_output_event_venue()
|
|
||||||
* @see sportspress_output_event_performance()
|
* @see sportspress_output_event_performance()
|
||||||
*/
|
*/
|
||||||
add_action( 'sportspress_single_event_content', 'sportspress_output_event_video', 10 );
|
add_action( 'sportspress_single_event_content', 'sportspress_output_event_video', 10 );
|
||||||
add_action( 'sportspress_single_event_content', 'sportspress_output_event_results', 20 );
|
add_action( 'sportspress_single_event_content', 'sportspress_output_event_overview', 30 );
|
||||||
add_action( 'sportspress_single_event_content', 'sportspress_output_event_details', 30 );
|
|
||||||
add_action( 'sportspress_single_event_content', 'sportspress_output_event_venue', 40 );
|
|
||||||
add_action( 'sportspress_single_event_content', 'sportspress_output_event_performance', 50 );
|
add_action( 'sportspress_single_event_content', 'sportspress_output_event_performance', 50 );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event Overview Content
|
||||||
|
*
|
||||||
|
* @see sportspress_output_event_details()
|
||||||
|
* @see sportspress_output_event_venue()
|
||||||
|
* @see sportspress_output_event_results()
|
||||||
|
*/
|
||||||
|
add_action( 'sportspress_event_overview_content', 'sportspress_output_event_details', 10 );
|
||||||
|
add_action( 'sportspress_event_overview_content', 'sportspress_output_event_venue', 20 );
|
||||||
|
add_action( 'sportspress_event_overview_content', 'sportspress_output_event_results', 30 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Single Calendar Content
|
* Single Calendar Content
|
||||||
*
|
*
|
||||||
@@ -53,8 +62,10 @@ add_action( 'sportspress_single_calendar_content', 'sportspress_output_calendar'
|
|||||||
/**
|
/**
|
||||||
* Before Single Team
|
* Before Single Team
|
||||||
* @see sportspress_output_team_logo()
|
* @see sportspress_output_team_logo()
|
||||||
|
* @see sportspress_output_post_excerpt()
|
||||||
*/
|
*/
|
||||||
add_action( 'sportspress_before_single_team', 'sportspress_output_team_logo', 10 );
|
add_action( 'sportspress_before_single_team', 'sportspress_output_team_logo', 10 );
|
||||||
|
add_action( 'sportspress_before_single_team', 'sportspress_output_post_excerpt', 20 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Single Team Content
|
* Single Team Content
|
||||||
@@ -73,6 +84,12 @@ add_action( 'sportspress_single_team_content', 'sportspress_output_team_tables',
|
|||||||
*/
|
*/
|
||||||
add_action( 'sportspress_after_single_team', 'sportspress_output_team_link', 10 );
|
add_action( 'sportspress_after_single_team', 'sportspress_output_team_link', 10 );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Before Single Table
|
||||||
|
* @see sportspress_output_post_excerpt()
|
||||||
|
*/
|
||||||
|
add_action( 'sportspress_before_single_table', 'sportspress_output_post_excerpt', 20 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Single Table Content
|
* Single Table Content
|
||||||
*
|
*
|
||||||
@@ -83,16 +100,18 @@ add_action( 'sportspress_single_table_content', 'sportspress_output_league_table
|
|||||||
/**
|
/**
|
||||||
* Before Single Player
|
* Before Single Player
|
||||||
* @see sportspress_output_player_photo()
|
* @see sportspress_output_player_photo()
|
||||||
|
* @see sportspress_output_player_details()
|
||||||
|
* @see sportspress_output_post_excerpt()
|
||||||
*/
|
*/
|
||||||
add_action( 'sportspress_before_single_player', 'sportspress_output_player_photo', 10 );
|
add_action( 'sportspress_before_single_player', 'sportspress_output_player_photo', 10 );
|
||||||
|
add_action( 'sportspress_before_single_player', 'sportspress_output_player_details', 15 );
|
||||||
|
add_action( 'sportspress_before_single_player', 'sportspress_output_post_excerpt', 20 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Single Player Content
|
* Single Player Content
|
||||||
*
|
*
|
||||||
* @see sportspress_output_player_details()
|
|
||||||
* @see sportspress_output_player_statistics()
|
* @see sportspress_output_player_statistics()
|
||||||
*/
|
*/
|
||||||
add_action( 'sportspress_single_player_content', 'sportspress_output_player_details', 10 );
|
|
||||||
add_action( 'sportspress_single_player_content', 'sportspress_output_player_statistics', 20 );
|
add_action( 'sportspress_single_player_content', 'sportspress_output_player_statistics', 20 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -105,15 +124,12 @@ add_action( 'sportspress_single_list_content', 'sportspress_output_player_list',
|
|||||||
/**
|
/**
|
||||||
* Before Single Staff
|
* Before Single Staff
|
||||||
* @see sportspress_output_staff_photo()
|
* @see sportspress_output_staff_photo()
|
||||||
|
* @see sportspress_output_staff_details()
|
||||||
|
* @see sportspress_output_post_excerpt()
|
||||||
*/
|
*/
|
||||||
add_action( 'sportspress_before_single_staff', 'sportspress_output_staff_photo', 10 );
|
add_action( 'sportspress_before_single_staff', 'sportspress_output_staff_photo', 10 );
|
||||||
|
add_action( 'sportspress_before_single_staff', 'sportspress_output_staff_details', 15 );
|
||||||
/**
|
add_action( 'sportspress_before_single_staff', 'sportspress_output_post_excerpt', 20 );
|
||||||
* Single Staff Content
|
|
||||||
*
|
|
||||||
* @see sportspress_output_staff_details()
|
|
||||||
*/
|
|
||||||
add_action( 'sportspress_single_staff_content', 'sportspress_output_staff_details', 10 );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Venue Archive Content
|
* Venue Archive Content
|
||||||
@@ -409,3 +425,11 @@ function sportspress_hide_adjacent_post_links( $output = null, $format = null, $
|
|||||||
|
|
||||||
add_filter('post_updated_messages', 'sportspress_post_updated_messages');
|
add_filter('post_updated_messages', 'sportspress_post_updated_messages');
|
||||||
|
|
||||||
|
function sportspress_remove_page_parent_class( $classes, $item ) {
|
||||||
|
if ( ( is_sp_post_type( get_post_type() ) && $key = array_search( 'current_page_parent', $classes ) ) !== false ) {
|
||||||
|
unset( $classes[$key] );
|
||||||
|
}
|
||||||
|
return $classes;
|
||||||
|
}
|
||||||
|
|
||||||
|
add_filter( 'nav_menu_css_class', 'sportspress_remove_page_parent_class', 10, 2 );
|
||||||
|
|||||||
14
templates/event-overview.php
Normal file
14
templates/event-overview.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Event Results/Details
|
||||||
|
*
|
||||||
|
* @author ThemeBoy
|
||||||
|
* @package SportsPress/Templates
|
||||||
|
* @version 1.9
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||||
|
?>
|
||||||
|
<div class="sp-event-overview">
|
||||||
|
<?php do_action( 'sportspress_event_overview_content' ); ?>
|
||||||
|
</div>
|
||||||
19
templates/post-excerpt.php
Normal file
19
templates/post-excerpt.php
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Post Excerpt
|
||||||
|
*
|
||||||
|
* @author ThemeBoy
|
||||||
|
* @package SportsPress/Templates
|
||||||
|
* @version 1.9
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||||
|
|
||||||
|
$id = get_the_ID();
|
||||||
|
$post = get_post( $id );
|
||||||
|
$excerpt = $post->post_excerpt;
|
||||||
|
if ( $excerpt ) {
|
||||||
|
?>
|
||||||
|
<p class="sp-excerpt"><?php echo $excerpt; ?></p>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user