Removal of the h1 title on single event pages

Home Forums Calendar Products Events Calendar PRO Removal of the h1 title on single event pages

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1484221
    Tim Church
    Participant

    Hi,

    I’ve been integrating The Events Calendar into Genesis recently and have found it quite a challange when i’m trying to specifically avoid the use of templates.

    One of the issues I am having and can’t find a way around is removing a duplicate h1 added by the events calendar on single event pages.

    How can I remove this bit of code without using a template?
    <?php the_title( ‘

    ‘, ‘

    ‘ ); ?>
    /the-events-calendar/src/viewssingle-event.php – line 34

    I’ve tried using a filter on the_title and it affects my h1 added to the page.
    Hiding with CSS wont hide it from search engines – two h1’s are bad for SEO.

    Thanks

    #1484222
    Tim Church
    Participant

    This reply is private.

    • This reply was modified 6 years ago by Tim Church.
    #1484385
    Tim Church
    Participant

    Hi,

    Working on the site still, I notice this issue of mine spans to organiser / venue pages as well.

    I would also like to remove it here please.

    Thanks

    #1486205
    Sky
    Keymaster

    Hi Tim!

    If you want to do this without creating a custom template, you can use WordPress’s filter for “the_title”

    Here is a PHP snippet that should do what you are asking:


    <?php
    add_filter( 'the_title', 'remove_event_post_titles', 10, 2 );
    function remove_event_post_titles( $title ) {
    if( is_singular( 'tribe_events' ) || is_singular('tribe_venue') || is_singular('tribe_organizer') ):
    return '';
    else:
    return $title;
    endif;
    }

    You can add that to your theme or child-theme’s functions.php or create a custom plugin for it.

    Let me know if that helps!

    Thanks,
    Sky

    #1487288
    Tim Church
    Participant

    Hi Sky,

    So I gave that a go, I actually used a the filter in a similar way without the extra function, I am suprised I didn’t try it like this!

    Either way, it still gave the same result I had in where it effects more then just the title i’m looking to remove. The best way to see this is by looking at my image attached.

    As you can see in the image, lots of other parts of the page are affected, along with my custom menu (Running from a plugin).

    Another issue is I have moved the title, i’ve looked through your code and have used tribe_events_title( FALSE ); to put the title where I’d like it. Any function like above would also affect the output of this wouldn’t it?

    Looking over all this further, on the organisers and venues page, the title outputted is actually h2, so in fact these could stay as its not an SEO error.

    The single events page is the main issue as that one is h1, perhaps if we cant remove it, are we able to change its tags to h2?

    At least that will avoid the error and hopefully make this a bit easier? 🙂

    Thanks

    #1488704
    Sky
    Keymaster

    Tim,

    Ah, I see this issue with this now. Both your theme and the Events plugin are using “the_title” filter so this applies to both. Unfortunately, I don’t think there is a way to target just one of them using the filter.

    You will need to create a custom template in order to do this. You can read more about this at our Themer’s Guide. But basically, you will copy the single-event.php file into your child theme in a “tribe-events” folder, and make your desired edits.

    Thanks, and let me know if you have any other questions.
    Sky

    #1501242
    Tim Church
    Participant

    Hi Sky,

    I thought that was the case, trouble is with this, i’ve spent hours developing this site without using a template. Templates need to be kept upto date and I’m trying to avoid doing that to save it being forgotten.

    Could the devs for the events calendar add a filter or a hook for this please?

    I can’t see it affecting anyone else (And would be helpful for people like myself)?

    Thanks

    #1503224
    Sky
    Keymaster

    Tim,

    The other option I can recommend is to use CSS to hide the title generated by The Events Calendar. Not quite as good as removing it from the template, but it will hide the element.

    You can visit our User Voice forum to request the use of a filter here.

    Thanks,
    Sky

    #1521169
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Removal of the h1 title on single event pages’ is closed to new replies.