Support » Plugin: The Events Calendar » Event page title is replaced by Archive

  • Hello,

    I am using Primer/Scribble theme with free version of the event calendar. All works well except,

    List view shows “Archives: Events” on the page title.
    Month view shows “Archives:” on the page title.
    Day view shows “Archives: Events” on the page title.

    WEBSITE URL: http://www.islamicsocietysr.org/events

    Please help me remove the “Archives:” part, I have searched around and am now ready to bang my head on the wall to resolve this issue.

    Thanks.

    • This topic was modified 7 months, 3 weeks ago by  ebaad.

    The page I need help with: [log in to see the link]

Viewing 13 replies - 1 through 13 (of 13 total)
  • +1. I have been chasing this for a few days myself.

    I have done some digging and I can see where my theme is pulling the Archive attribute. This appears to be something hard set by Event Calendar. Go to Appearance > Menus and you’ll see that the top level Event is labeled “Post Type Archive”. Every sub-event category then is labeled simply “Event”. So this is something with Event Calendar that is setting itself to “Archive”. I’ll see if I can find any clues in the database.

    Think this may be a major hint:

    https://codex.wordpress.org/Post_Types#Custom_Post_Type_Templates

    Thanks for helping to resolve, I tried to install the same plugin on test site with simple twentytwelve theme and it works perfect.

    Still not sure what is conflicting to create this issue.

    Please let me know if you find any thing.
    Thanks.

    Also just noticed that “Blog” link shows as active link if “Events” is clicked, not sure why…

    • This reply was modified 7 months, 3 weeks ago by  ebaad.

    Ok, so I figured out the issue. In my theme, there is a logic block for the page title that looks like this:

    function spacious_header_title() {
    	if( is_archive() ) {
    		if ( is_category() ) :
    			$spacious_header_title = single_cat_title( '', FALSE );
    
    		elseif ( is_tag() ) :
    			$spacious_header_title = single_tag_title( '', FALSE );
    
    		elseif ( is_author() ) :
    			/* Queue the first post, that way we know
    			 * what author we're dealing with (if that is the case).
    			*/
    			the_post();
    			$spacious_header_title =  sprintf( __( 'Author: %s', 'spacious' ), '<span class="vcard">' . get_the_author() . '</span>' );
    			/* Since we called the_post() above, we need to
    			 * rewind the loop back to the beginning that way
    			 * we can run the loop properly, in full.
    			 */
    			rewind_posts();
    
    		elseif ( is_day() ) :
    			$spacious_header_title = sprintf( __( 'Day: %s', 'spacious' ), '<span>' . get_the_date() . '</span>' );
    
    		elseif ( is_month() ) :
    			$spacious_header_title = sprintf( __( 'Month: %s', 'spacious' ), '<span>' . get_the_date( 'F Y' ) . '</span>' );
    
    		elseif ( is_year() ) :
    			$spacious_header_title = sprintf( __( 'Year: %s', 'spacious' ), '<span>' . get_the_date( 'Y' ) . '</span>' );
    
    		elseif ( is_tax( 'post_format', 'post-format-aside' ) ) :
    			$spacious_header_title = __( 'Asides', 'spacious' );
    
    		elseif ( is_tax( 'post_format', 'post-format-image' ) ) :
    			$spacious_header_title = __( 'Images', 'spacious');
    
    		elseif ( is_tax( 'post_format', 'post-format-video' ) ) :
    			$spacious_header_title = __( 'Videos', 'spacious' );
    
    		elseif ( is_tax( 'post_format', 'post-format-quote' ) ) :
    			$spacious_header_title = __( 'Quotes', 'spacious' );
    
    		elseif ( is_tax( 'post_format', 'post-format-link' ) ) :
    			$spacious_header_title = __( 'Links', 'spacious' );
    
    		elseif ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) :
    			$spacious_header_title = woocommerce_page_title( false );
    
    		/* Remove Archives title CJB 3/1/2019
    		 else :
    			$spacious_header_title = __( 'Archives', 'spacious' );
    */
    		endif;

    Essentially, seeing that the calendar has no tag, author, category etc. associated with it, the theme goes to an else of last resort which sets the title to Archives. Note, I commented out that section and things are great.

    I followed this link to add my calendar to the menu.

    https://support.theeventscalendar.com/616696-Adding-a-calendar-link-to-your-site-menu

    A MUCH MUCH MUCH better way to add the Events Calendar to a link is to create a page and use the [tribe_events] shortcode. However, this is only in the Pro version. Thus, you and I are hacking themes it seems. 🙁

    This is great, but I don’t see this piece of code in my theme, tried to grep the directory, but no luck so far.
    I was able to create a custom link in menu and pointed it to events page to add a nav link.

    Yes, it sucks to have everything available in pro version… 🙁

    • This reply was modified 7 months, 3 weeks ago by  ebaad.
    • This reply was modified 7 months, 3 weeks ago by  ebaad.

    FINALLY!!!!

    Found that there is a helpers file in include directory that sets up the $title, so commented out the original line and esc_html__ custom message ‘Event’ and it did the magic!!!

    It feels so good to figure this out, but do credit you for inspiration.

    Thanks.

    
    /**
     * Return a page title based on the current page.
     *
     * @since 1.0.0
     *
     * @return string Returns the current page title.
     */
    function primer_get_the_page_title() {
    
            $title = '';
            $post  = get_queried_object();
    
            switch ( true ) {
    
                    case is_front_page() :
    
                            $title = ( 'posts' === get_option( 'show_on_front' ) ) ? get_theme_mod( 'front_page_title', '' ) : get_the_title( get_option( 'page_on_front' ) );
    
                            break;
    
                    case is_home() :
    
                            $title = get_the_title( get_option( 'page_for_posts' ) );
    
                            break;
    
                    case is_archive() :
    
                            /* ADDED EVENT TITLE TO REPLACE ARCHIVE IN EVENT CALENDAR POSTS --- EA 01/03/2019*/
                            //$title = wp_strip_all_tags( get_the_archive_title() );
                            $title = esc_html__('Events', 'primer');
                            break;
    
                    case is_search() :
    
                            $title = sprintf(
                                    /* translators: search term */
                                    esc_html__( 'Search Results for: %s', 'primer' ),
                                    get_search_query()
                            );
    
    • This reply was modified 7 months, 3 weeks ago by  ebaad.
    • This reply was modified 7 months, 3 weeks ago by  James Huff.

    For what it is worth, I created a child theme and added the function I edited to the functions.php file within the child theme. This will prevent your tweaks from being over written when the theme is updated. I am not sure if you have used child themes before, but this could save you some headache in the future.

    You are absolutely correct, when I started this website few years back, I was still learning and did not know much about child theme and how to create it, but now as much changes I have done, I think that is the right way to go.

    I am testing one on the side and once that is functional, will replace this with child-theme.

    Plugin Support Ed

    (@erishel)

    Hey there,

    Thanks for reaching out 😄

    Sorry for the wait! We’ve been experiencing a high volume of support requests.

    Are you using Yoast SEO? If so, these titles can be adjusted in the Yoast settings.

    Take care,
    Ed 🤟

    I don’t think that is the case as I tried Yoast and several other plugins that do as yo describe. See the code block above. The theme was entering “Archives” as a title as a last resort despite the post not being classified as archive.

    I was able to fix the issue using Yoast SEO – Under the Taxonomies tab, Events Categories. Remove the work Archive from the SEO title.

    Easy fix, no need to mess with template code…

    terry777

    (@terry777)

    Thanks @igltech for this solution. Taxonomies didn’t work for me, but what worked using Yoast SEO was under the Content Types Tab, Events Archive. Remove the word Archive from under the SEO title.

Viewing 13 replies - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.