• Resolved Dzynit

    (@dzynit)


    I found a way to make the simple press forum page titles unique in combo with your plugin still working good on non-forum pages. I need to do that with the description now too, but I can’t figure out how to tap into the description your plugin produces so I can add the conditional and add the new page title at the end of the descriptions so they’re unique also.

    This is what I did for the titles:

    to the theme’s functions.php

    function forumtitle() {
    	$urlparts = explode("/",$_SERVER["REQUEST_URI"]);
    	$title=ucwords(str_replace("-"," ",$urlparts[count($urlparts)-2]));
    	if ($title == 'Forum') { $title = 'The main landing page forum title'; }
    	return $title;
    }

    In the header.php (id of course being the forum’s main page id #)

    <title><?php if(get_the_id() == 392) { echo forumtitle(); } else { wp_title(); } ?></title>

    Could you help with ideas on this?
    Thanks, Heather

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Dzynit

    (@dzynit)

    For anyone else this may help. Yoast wordpress seo responded on the correct filters to work with:

    For the title you can use the wpseo_title filter and for meta description there’s a filter named: wpseo_metadesc.

    Thread Starter Dzynit

    (@dzynit)

    Here’s what I used for the description:

    function forumdescript($descript) {
    	global $post;
    	if ($post->ID == '392') {
    		$urlparts = explode("/",$_SERVER["REQUEST_URI"]);
    		$title=ucwords(str_replace("-"," ",$urlparts[count($urlparts)-2]));
    		if ($title == 'Forum') { $title = 'Your forum title'; }		$descript = $title.' -'.$descript;
    
    		return $descript;
    	}
    }
    add_filter( 'wpseo_metadesc', 'forumdescript');
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Yoast and SimplePress’ is closed to new replies.