Support » Plugin: Yoast SEO » OG:Title to display posts category

  • I dont know if this is possible, but I have tried using my own limited experience..its not working!
    Thats why I need the help of this wonderful community.
    My site relies more on facebook audience and as such I have automated my posts to be posted on the facebook page..once published.
    However, I need something that is not available in the mainstream…maybe a customized hack.
    I want the og:title of my posts to contain the posts category.
    I have succeeded in adding the category to og:description..but now I want the same category to appear in the titles as well.
    For example:
    og:title = Chicken Chips- Foods
    Foods being the category.
    I want to believe that this is possible…please I need your HELP!!!
    Thanks everyone for taking the time to be of help.

    http://wordpress.org/plugins/wordpress-seo/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi wtoalabi,

    There’s a filter for that 😉
    (Hope you used a filter for the og:description ‘hack’ as well)

    Just add something along the lines of the below to your (child-)theme’s functions.php file:

    function my_og_title( $title ) {
    	// Do what you want to the $title, like:
    	// Retrieve the category and add it
    	// $title = $title . ' - ' . $category
    	return $title;
    }
    add_filter( 'wpseo_opengraph_title', 'my_og_title' );

    Oh and in case you didn’t know: the filter for the og:description tag is called wpseo_opengraph_desc.

    Hope this helps!

    Smile,
    Juliette

    Thanks so much Juliete!
    Well, I wouldnt call what I did with the “description” tag a hack..lol
    I just added this to the Posts Type inside Titles & Metas: %%title%% %%page%% %%sep%% %%category%%.
    Now, when I did the same for the title, it shows just the post name and the site name..like this:
    New Post – Site Name
    Then I tried to follow your codes above..same thing.
    Am glad there is a code to even think about…it gives me more assurance that this is possible.
    Thanks so much for your help!!!
    ‘Wale

    Hi Wale,

    Definitely not a hack 😉

    And the code I gave you above is not complete – it currently only receives the title and returns it-. I put it there to give you an idea of how to change the title. That’s the part you’ll need to program yourself. So in effect, it’s just a little code framework to fill in.

    I’m sure you can figure it out 😉

    Smile,
    Juliette

    Yeah right…I cant even figure the } function
    if it works right past me…lol
    I cant do this…but I expected the wp seo admin configurations to handle it…since it cant..well, am here!
    You’ve gat to help PLEASE!!!!
    Thanks.
    with Cheers…
    ‘Wale.

    jrf

    (@jrf)

    You’ve gat to help PLEASE!!!!

    ahum… everyone here who makes the effort to reply to questions is a volunteer….

    Either learn how to do it or may be hire someone ?

    wtoalabi

    (@wtoalabi)

    Well, the weirdest thing seem to be that all I needed to do was to upgrade both Yoast and Jetpack!
    Og:titles are now being pulled from the parameters I set in Yoast!
    Simple…Amazing
    But thanks for your offer of help so far…am so grateful!!!
    Now, I can breathe easy.
    Cheers,
    ‘Wale

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘OG:Title to display posts category’ is closed to new replies.