• Resolved matsa24

    (@matsa24)


    Hello there,

    I want to specify my own title and description only on 1 page.

    Can I use these filters

    the_seo_framework_title_from_custom_field
    the_seo_framework_custom_field_description

    or should I use others?

    using php, I want to generate my title and description on 1 page. Example:

    add_filter( 'the_seo_framework_title_from_custom_field', 'bc_seo_title'  );
    add_filter( 'the_seo_framework_custom_field_description', 'bc_seo_description'  );
    
    function bc_seo_title($title){
    
        $tsf = the_seo_framework();
    
        if ( $tsf->get_the_real_ID() == 45912 ) {
        /*a little code for generating text*/
    
            $title = "my own title";
    
        }
        return $title;
    }
    function bc_seo_description($descr){
    
        $tsf = the_seo_framework();
    
        if ( $tsf->get_the_real_ID() == 45912 ) {
    
            $descr = "my own descr";
    
        }
        return $descr;
    }

    Did I do everything right? did I choose the right filters?

    thanks!

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

    (@cybr)

    Howdy!

    If you intend to overwrite the title inputted by the user via TSF’s UI, then those are the correct filters.

    However, if you mean to overwrite the generated title and allow the user to overwrite that via the UI still, then I recommend using filters the_seo_framework_title_from_generation and the_seo_framework_generated_description.

    It’s easiest to use the interface to set a custom title, however.

Viewing 1 replies (of 1 total)
  • The topic ‘Own title and description only on 1 page.’ is closed to new replies.