get the Events landing page title to change to Events – not latest event

Home Forums Calendar Products Events Calendar PRO get the Events landing page title to change to Events – not latest event

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1015185
    David
    Participant

    Hi Guys,

    I need the Events landing page title to be “Events”, currently it uses the title of the next event which makes no sense to me.

    I’ve tried this code from other sort of similar posts: https://gist.github.com/jesseeproductions/f4937c82325ab152cb24 not joy 🙁

    I also need the Breadcrumb to work, currently it’s just Home, or Home > Event Title but I need:

    Home > Events > Name of Event

    #1015193
    David
    Participant

    This reply is private.

    #1015295
    George
    Participant

    Hey @David,

    Sorry to hear about these issues – Brian’s script indeed won’t work here, because that script addresses a problem from the Yoast SEO plugin. Your issue here, meanwhile, is related to/caused by your theme, as evidenced in the header tag’s HTML:

    We don’t officially offer any theme support and such, but if you can send a .zip of your theme over to use by uploading it to http://ge.tt and then sharing the link there, I will download the theme and take a look at what is generating this. I should be able to recommend some code to fix this.

    A simple solution would be to just use JavaScript to overwrite this from the outset on page load. You can do that by adding this code snippet to your theme or child theme’s functions.php file:

    
    if ( function_exists( 'tribe_get_events' ) ) {
        /**
         * Force the page title to say "Events".  
         * @link http://theeventscalendar.com/?p=1015185
         */
        function tribe_support_1015185() {
            ?><script>
                var title_replace = document.querySelector( '.uk-article-title' );
                title_replace.innerText = title_replace.textContent = 'Events';
            </script><?php
        }
    
        add_action( 'wp_footer', 'tribe_support_1015185' );
    }
    
    • This reply was modified 10 years, 6 months ago by George.
    #1015308
    David
    Participant

    Thanks George, the js fix sort of works but it replaces all page titles.

    This is the piece of code…

                     <?php if ($this['config']->get('page_title', true)) : ?>
                     <div class="uk-container uk-container-center">
                        <h1 class="uk-article-title"><?php the_title(); ?></h1>
                     </div>
                    <?php endif; ?>

    I’ve uploaded the zip here: http://ge.tt/2kSIH9Q2/v/0?c

    The file for this is yoo_katana_wp/styles/imro-one/theme.php

    #1015433
    George
    Participant

    Hey David,

    Thanks for this! I think that if you add code like the following to your theme’s functions.php file, you’ll be good to go:


    if ( function_exists( 'tribe_get_events' ) ) {
    /**
    * Force the page title to say "Events", for real.
    * @link http://theeventscalendar.com/?p=1015185
    */
    function tribe_support_1015185_title( $title, $post_id ) {

    if ( tribe_is_event( $post_id ) && is_single() )
    $title = 'Events';

    return $title;
    }

    add_filter( 'the_title', 'tribe_support_1015185_title', 10, 2 );
    }

    I hope this helps!

    George

    #1015730
    David
    Participant

    Thanks George, this actually works the opposite of what we need.

    The All Events page has the event title which the single event page is titled Events.

    Can you tell me how to switch them around?

    David

    #1016273
    George
    Participant

    AH, sorry about that David! Dumb mistake on my part. Unfortunately I don’t know your theme well enough to customize the proper title you’re referring to; I’d recommend keeping the somewhat-okay JavaScript version for now, as a temporary fix, while you contact your theme developer for help with doing it “properly” via php…

    One thing you can try is, instead of using my original function, just replace the existing code within the theme to become this:


    <?php if ($this['config']->get('page_title', true)) : ?>
    <div class="uk-container uk-container-center">
    <h1 class="uk-article-title"><?php if ( tribe_is_event( get_the_ID() ) ) ? 'Events' : the_title(); ?></h1>
    </div>
    <?php endif; ?>

    Thanks for your patience here David; I hope my code here helps, and if not, then I hope my suggestion with regards to your theme developer help instead.

    Let me know if either is the case! 🙂

    Sincerely,
    George

    #1016275
    George
    Participant

    AH, sorry about that David! Dumb mistake on my part. Unfortunately I don’t know your theme well enough to customize the proper title you’re referring to; I’d recommend keeping the somewhat-okay JavaScript version for now, as a temporary fix, while you contact your theme developer for help with doing it “properly” via php…

    One thing you can try is, instead of using my original function, just replace the existing code within the theme to become this:


    <?php if ($this['config']->get('page_title', true)) : ?>
    <div class="uk-container uk-container-center">
    <h1 class="uk-article-title"><?php echo tribe_is_event( get_the_ID() ) ? 'Events' : the_title(); ?></h1>
    </div>
    <?php endif; ?>

    Thanks for your patience here David; I hope my code here helps, and if not, then I hope my suggestion with regards to your theme developer help instead.

    Let me know if either is the case! 🙂

    Sincerely,
    George

    #1016284
    David
    Participant

    Thanks George, unfortunately that doesn’t make a difference for the good, for the time being I’m switching to the first option which isn’t perfect but covers most of the titles.

    Did you have any suggestions for the Breadcrumb issues so that:

    Home > Event Title

    is

    
    Home > Events > Event Title

    ?

    David

    #1016624
    George
    Participant

    Sorry about the lack of success with the secondary methods David – thanks for trying out my suggestions!

    When it comes to your breadcrumbs, these are unfortunately a bit more complicated and theme-specific so you’d unfortunately have to do some more extensive customization than what can be assisted with here on the forums. I’d recommend contacting your theme developer for help with that specifically if possible!

    Best of luck with your site 🙂

    George

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘get the Events landing page title to change to Events – not latest event’ is closed to new replies.