Support » Plugin: The SEO Framework » Help W/Function to Remove Title from Template

  • Resolved joshuabaer23

    (@joshuabaer23)


    I am using a plugin called Tribe Events for this page. It is not a wp page which can be edited, but a template.
    thepollinationproject.org/events/community/add/

    Note the tab title is WP Router Placeholder.

    The plugin author provided me this function to change it, but it seems the SEO plugin is preventing it from working. If I disable the SEO plugin, the title changes as expected.

    add_filter('tribe_ce_submit_event_page_title', 'change_the_title');
    function change_the_title() {
      return 'Your New Title Goes Here';
    }

    I am attempting to edit this function so it hooks your title code. Is there any way you would be able to assist me on that? I cant seem to figure out the argument on it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Sybre Waaijer

    (@cybr)

    Hi @joshuabaer23,

    I already found the related topic (through Google Alerts) regarding this subject.

    Direct approach:
    I’m unsure about the conditional tag required, so I Googled a bit to find the closest match. When in doubt, ask their support 🙂

    Nevertheless, I think you require this filter:

    
    add_filter( 'the_seo_framework_pre_add_title', function( $title = '', $args = array(), $escape = true ) {
    
    	/** 
    	 * Find conditional tags for TEC here: 
    	 * @link https://gist.githubusercontent.com/theeventscalendar/9b9721b085a95ea201a9/raw/6e96d1e2992aca4532c245c2698a44e7605b43c6/tribe-events-title-tag.php
    	 *
    	 * If you don't know which conditional tag should be used, ask their support.
    	 */
    	if ( function_exists( 'tribe_is_event' ) && tribe_is_event() && is_single() ) {
    		$title = 'Your new Title';
    	}
    
    	return $title;
    }, 10, 3 );

    Alternative approach:
    I’m unsure if this applies to your case, as I’m still a bit hazy on what you’ve done to add the submissions template. But, in any case:

    Alternatively, you can take the whole code from here.

    But, instead of using this filter:

    add_filter( 'tribe_events_title_tag', 'filter_events_title' );
    

    Use this one:

    add_filter( 'the_seo_framework_pre_add_title', 'filter_events_title' );
    

    Be careful about that their filter requires The Events Calendar to be active at all times, or your site will crash.

    I hope this helps 🙂 Let me know if it requires refining. Cheers!

    • This reply was modified 4 years, 2 months ago by Sybre Waaijer. Reason: clarity
    Thread Starter joshuabaer23

    (@joshuabaer23)

    Thank you. You provided me with what I needed to complete the function: ‘the_seo_framework_pre_add_title’

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Help W/Function to Remove Title from Template’ is closed to new replies.