Home › Forums › Calendar Products › Events Calendar PRO › Hiding next and Previous Events when on the details Page
- This topic has 5 replies, 2 voices, and was last updated 8 years, 6 months ago by
Nancy.
-
AuthorPosts
-
October 24, 2017 at 12:07 pm #1368295
Nancy
ParticipantThis is a followup question from the support thread started on September 18, 2017 with Patricia.
I recently had to do a site restore which clobbered the php change in this thread. So, I have to do this again (please see thread for instructions) and I am wondering if I should make this change in the child php theme. If I do not, everytime the theme is updated, this php fix will be over written. Is it okay to place this in the child’s php sheet?
Thank you for your response!
Regards,
NancyOctober 25, 2017 at 3:52 pm #1368929Geoff B.
MemberGood evening Nancy and welcome back!
Thank you for reaching out to us.
I would love to help you with this topic.I am wondering if I should make this change in the child php theme. Is it okay to place this in the child’s php sheet?
Absolutely, in fact this is the recommended approach.
If you see that the changes are not kicking in, you could use the !important argument in your CSS rules.
Let me know how that goes.
Best regards,
Geoff B.October 27, 2017 at 2:55 am #1369911Nancy
ParticipantHey Geoff,
I entered the script in the child theme, and it produced a 500 error.
Here is what is currently in the child .php sheet:<?php
// =============================================================================
// FUNCTIONS.PHP
// —————————————————————————–
// Overwrite or add your own custom functions to Pro in this file.
// =============================================================================// =============================================================================
// TABLE OF CONTENTS
// —————————————————————————–
// 01. Enqueue Parent Stylesheet
// 02. Additional Functions
// =============================================================================// Enqueue Parent Stylesheet
// =============================================================================add_filter( ‘x_enqueue_parent_stylesheet’, ‘__return_true’ );
// Additional Functions
// =============================================================================function tribe_alter_event_archive_titles ( $original_recipe_title, $depth ) {
// Modify the titles here
// Some of these include %1$s and %2$s, these will be replaced with relevant dates
$title_upcoming = ‘Upcoming Events at Saint James’; // List View: Upcoming events
$title_past = ‘Past Events’; // List view: Past events
$title_range = ‘Events for %1$s – %2$s’; // List view: range of dates being viewed
$title_month = ‘Saint James Events for %1$s’; // Month View, %1$s = the name of the month
$title_day = ‘Events for %1$s’; // Day View, %1$s = the day
$title_all = ‘All events for %s’; // showing all recurrences of an event, %s = event title
$title_week = ‘Events for week of %s’; // Week view
// Don’t modify anything below this unless you know what it does
global $wp_query;
$tribe_ecp = Tribe__Events__Main::instance();
$date_format = apply_filters( ‘tribe_events_pro_page_title_date_format’, tribe_get_date_format( true ) );
// Default Title
$title = $title_upcoming;
// If there’s a date selected in the tribe bar, show the date range of the currently showing events
if ( isset( $_REQUEST[‘tribe-bar-date’] ) && $wp_query->have_posts() ) {
if ( $wp_query->get( ‘paged’ ) > 1 ) {
// if we’re on page 1, show the selected tribe-bar-date as the first date in the range
$first_event_date = tribe_get_start_date( $wp_query->posts[0], false );
} else {
//otherwise show the start date of the first event in the results
$first_event_date = tribe_event_format_date( $_REQUEST[‘tribe-bar-date’], false );
}
$last_event_date = tribe_get_end_date( $wp_query->posts[ count( $wp_query->posts ) – 1 ], false );
$title = sprintf( $title_range, $first_event_date, $last_event_date );
} elseif ( tribe_is_past() ) {
$title = $title_past;
}
// Month view title
if ( tribe_is_month() ) {
$title = sprintf(
$title_month,
date_i18n( tribe_get_option( ‘monthAndYearFormat’, ‘F Y’ ), strtotime( tribe_get_month_view_date() ) )
);
}
// Day view title
if ( tribe_is_day() ) {
$title = sprintf(
$title_day,
date_i18n( tribe_get_date_format( true ), strtotime( $wp_query->get( ‘start_date’ ) ) )
);
}
// All recurrences of an event
if ( function_exists(‘tribe_is_showing_all’) && tribe_is_showing_all() ) {
$title = sprintf( $title_all, get_the_title() );
}
// Week view title
if ( function_exists(‘tribe_is_week’) && tribe_is_week() ) {
$title = sprintf(
$title_week,
date_i18n( $date_format, strtotime( tribe_get_first_week_day( $wp_query->get( ‘start_date’ ) ) ) )
);
}
if ( is_tax( $tribe_ecp->get_event_taxonomy() ) && $depth ) {
$cat = get_queried_object();
$title = ‘‘ . $title . ‘‘;
$title .= ‘ › ‘ . $cat->name;
}
return $title;
}
add_filter( ‘tribe_get_events_title’, ‘tribe_alter_event_archive_titles’, 11, 2 );/*
* Recurring events in wp-admin: only display first (parent) occurrence in list of Events
* (i.e. hide child recurring events)
*
* From https://theeventscalendar.com/knowledgebase/hide-recurring-event-instances-in-admin/
* – https://gist.github.com/cliffordp/81f23a207ab483c9e7c6d910f9b29c0a
* 2016-07-04 Barry shared this snippet from a previous customer’s own/shared customization
*
*/
class Events_Admin_List__Remove_Child_Events {
public function __construct() {
// Don’t kick in unless we’re on the edit.php screen
add_action( ‘load-edit.php’, array( $this, ‘setup’ ) );
}
public function setup() {
// Listen out for the main events query
if ( ‘tribe_events’ === $GLOBALS[ ‘typenow’ ] )
add_action( ‘parse_query’, array( $this, ‘modify’ ) );
}
function modify( WP_Query $query ) {
// Run once, only for the main query
if ( ! $query->is_main_query() ) return;
remove_action( ‘parse_query’, array( $this, ‘modify’) );
// Only return top level posts as a means of ignoring child posts
$query->set( ‘post_parent’, 0 );
}
}
new Events_Admin_List__Remove_Child_Events;function x_breadcrumbs() {
if ( x_get_option( ‘x_breadcrumb_display’ ) ) {
GLOBAL $post;
$is_ltr = ! is_rtl();
$stack = x_get_stack();
$delimiter = x_get_breadcrumb_delimiter();
$home_text = x_get_breadcrumb_home_text();
$home_link = home_url();
$current_before = x_get_breadcrumb_current_before();
$current_after = x_get_breadcrumb_current_after();
$page_title = get_the_title();
$blog_title = get_the_title( get_option( ‘page_for_posts’, true ) );if ( ! is_404() ) {
$post_parent = $post->post_parent;
} else {
$post_parent = ”;
}if ( X_WOOCOMMERCE_IS_ACTIVE ) {
$shop_url = x_get_shop_link();
$shop_title = x_get_option( ‘x_’ . $stack . ‘_shop_title’ );
$shop_link = ‘‘ . $shop_title . ‘‘;
}echo ‘<div class=”x-breadcrumbs”>‘ . $home_text . ‘‘ . $delimiter;
if ( is_home() ) {
echo $current_before . $blog_title . $current_after;
} elseif ( is_category() ) {
$the_cat = get_category( get_query_var( ‘cat’ ), false );
if ( $the_cat->parent != 0 ) echo get_category_parents( $the_cat->parent, TRUE, $delimiter );
echo $current_before . single_cat_title( ”, false ) . $current_after;} elseif ( x_is_product_category() ) {
if ( $is_ltr ) {
echo $shop_link . $delimiter . $current_before . single_cat_title( ”, false ) . $current_after;
} else {
echo $current_before . single_cat_title( ”, false ) . $current_after . $delimiter . $shop_link;
}} elseif ( x_is_product_tag() ) {
if ( $is_ltr ) {
echo $shop_link . $delimiter . $current_before . single_tag_title( ”, false ) . $current_after;
} else {
echo $current_before . single_tag_title( ”, false ) . $current_after . $delimiter . $shop_link;
}} elseif ( is_search() ) {
echo $current_before . __( ‘Search Results for ‘, ‘__x__’ ) . ‘“’ . get_search_query() . ‘”’ . $current_after;
} elseif ( is_singular( ‘post’ ) ) {
if ( get_option( ‘page_for_posts’ ) == is_front_page() ) {
echo $current_before . $page_title . $current_after;
} else {
if ( $is_ltr ) {
echo ‘‘ . $blog_title . ‘‘ . $delimiter . $current_before . $page_title . $current_after;
} else {
echo $current_before . $page_title . $current_after . $delimiter . ‘‘ . $blog_title . ‘‘;
}
}} elseif ( x_is_portfolio() ) {
echo $current_before . get_the_title() . $current_after;
} elseif ( x_is_portfolio_item() ) {
$link = x_get_parent_portfolio_link();
$title = x_get_parent_portfolio_title();if ( $is_ltr ) {
echo ‘‘ . $title . ‘‘ . $delimiter . $current_before . $page_title . $current_after;
} else {
echo $current_before . $page_title . $current_after . $delimiter . ‘‘ . $title . ‘‘;
}} elseif ( x_is_product() ) {
if ( $is_ltr ) {
echo $shop_link . $delimiter . $current_before . $page_title . $current_after;
} else {
echo $current_before . $page_title . $current_after . $delimiter . $shop_link;
}} elseif ( x_is_buddypress() ) {
if ( bp_is_group() ) {
echo ‘‘ . x_get_option( ‘x_buddypress_groups_title’ ) . ‘‘ . $delimiter . $current_before . x_buddypress_get_the_title() . $current_after;
} elseif ( bp_is_user() ) {
echo ‘‘ . x_get_option( ‘x_buddypress_members_title’ ) . ‘‘ . $delimiter . $current_before . x_buddypress_get_the_title() . $current_after;
} else {
echo $current_before . x_buddypress_get_the_title() . $current_after;
}} elseif ( x_is_bbpress() ) {
remove_filter( ‘bbp_no_breadcrumb’, ‘__return_true’ );
if ( bbp_is_forum_archive() ) {
echo $current_before . bbp_get_forum_archive_title() . $current_after;
} else {
echo bbp_get_breadcrumb();
}add_filter( ‘bbp_no_breadcrumb’, ‘__return_true’ );
} elseif ( is_page() && ! $post_parent ) {
echo $current_before . $page_title . $current_after;
} elseif ( is_page() && $post_parent ) {
$parent_id = $post_parent;
$breadcrumbs = array();if ( is_rtl() ) {
echo $current_before . $page_title . $current_after . $delimiter;
}while ( $parent_id ) {
$page = get_page( $parent_id );
$breadcrumbs[] = ‘ID ) . ‘”>’ . get_the_title( $page->ID ) . ‘‘;
$parent_id = $page->post_parent;
}if ( $is_ltr ) {
$breadcrumbs = array_reverse( $breadcrumbs );
}for ( $i = 0; $i < count( $breadcrumbs ); $i++ ) {
echo $breadcrumbs[$i];
if ( $i != count( $breadcrumbs ) -1 ) echo $delimiter;
}if ( $is_ltr ) {
echo $delimiter . $current_before . $page_title . $current_after;
}} elseif ( is_tag() ) {
echo $current_before . single_tag_title( ”, false ) . $current_after;
} elseif ( is_author() ) {
GLOBAL $author;
$userdata = get_userdata( $author );
echo $current_before . __( ‘Posts by ‘, ‘__x__’ ) . ‘“’ . $userdata->display_name . $current_after . ‘”’;} elseif ( is_404() ) {
echo $current_before . __( ‘404 (Page Not Found)’, ‘__x__’ ) . $current_after;
} elseif ( is_archive() ) {
if ( x_is_shop() ) {
echo $current_before . $shop_title . $current_after;
} elseif ( class_exists( ‘Tribe__Events__Main’ ) && tribe_is_event_query() ) {
echo $current_before . ‘Events’ . $current_after;
} else {
echo $current_before . __( ‘Archives ‘, ‘__x__’ ) . $current_after;
}}
echo ‘</div>’;
}
}
Then I added this the following, and this is what produced the error.
<?php
/**
* Single Event Template
* A single event. This displays the event title, description, meta, and
* optionally, the Google map for the event.
*
* Override this template in your own theme by creating a file at [your-theme]/tribe-events/single-event.php
*
* @package TribeEventsCalendar
* @version 4.3
*
*/if ( ! defined( ‘ABSPATH’ ) ) {
die( ‘-1’ );
}$events_label_singular = tribe_get_event_label_singular();
$events_label_plural = tribe_get_event_label_plural();$event_id = get_the_ID();
?>
<div id=”tribe-events-content” class=”tribe-events-single”>
<p class=”tribe-events-back”>
“> <?php printf( ‘« ‘ . esc_html_x( ‘All %s’, ‘%s Events plural label’, ‘the-events-calendar’ ), $events_label_plural ); ?><!– Notices –>
<?php tribe_the_notices() ?><?php the_title( ‘
‘, ‘
‘ ); ?>
<div class=”tribe-events-schedule tribe-clearfix”>
<?php echo tribe_events_event_schedule_details( $event_id, ‘‘, ‘
‘ ); ?>
<?php if ( tribe_get_cost() ) : ?>
<span class=”tribe-events-cost”><?php echo tribe_get_cost( null, true ) ?></span>
<?php endif; ?>
</div><!– Event header –>
<div id=”tribe-events-header” <?php tribe_events_the_header_attributes() ?>>
<!– Navigation –><?php printf( esc_html__( ‘%s Navigation’, ‘the-events-calendar’ ), $events_label_singular ); ?>
<ul class=”tribe-events-sub-nav”>
<!– .tribe-events-sub-nav –>
</div>
<!– #tribe-events-header –><?php while ( have_posts() ) : the_post(); ?>
<div id=”post-<?php the_ID(); ?>” <?php post_class(); ?>>
<!– Event featured image, but exclude link –>
<?php echo tribe_event_featured_image( $event_id, ‘full’, false ); ?><!– Event content –>
<?php do_action( ‘tribe_events_single_event_before_the_content’ ) ?>
<div class=”tribe-events-single-event-description tribe-events-content”>
<?php the_content(); ?>
</div>
<!– .tribe-events-single-event-description –>
<?php do_action( ‘tribe_events_single_event_after_the_content’ ) ?><!– Event meta –>
<?php do_action( ‘tribe_events_single_event_before_the_meta’ ) ?>
<?php tribe_get_template_part( ‘modules/meta’ ); ?>
<?php do_action( ‘tribe_events_single_event_after_the_meta’ ) ?>
</div> <!– #post-x –>
<?php if ( get_post_type() == Tribe__Events__Main::POSTTYPE && tribe_get_option( ‘showComments’, false ) ) comments_template() ?>
<?php endwhile; ?><!– Event footer –>
<div id=”tribe-events-footer”>
<!– Navigation –><?php printf( esc_html__( ‘%s Navigation’, ‘the-events-calendar’ ), $events_label_singular ); ?>
<ul class=”tribe-events-sub-nav”>
<!– .tribe-events-sub-nav –>
</div>
<!– #tribe-events-footer –></div><!– #tribe-events-content –>
October 27, 2017 at 3:03 am #1369917Nancy
ParticipantHey Geof,
Great news, I was able to hide the element using css. I’d rather use css anyway, so I think we’re good on this issue.thank you!
Nancy`.tribe-events-sub-nav .tribe-events-nav-previous {
display: none !important;
}.tribe-events-nav-next {
display: none !important;
}October 27, 2017 at 9:58 pm #1370553Geoff B.
MemberHey Nancy,
Fantastic!
Yeah sometimes good old CSS is the way to go. It’s quick and simple.
Kudos on getting the results you were after.You are welcome back in our support forums any time 🙂
For now, I am going to close this thread.
Have a great weekend!
Geoff B.
-
AuthorPosts
- The topic ‘Hiding next and Previous Events when on the details Page’ is closed to new replies.
