WordPress.org

Ready to get started?Download WordPress

Forums

WordPress SEO by Yoast
Meta Descriptions for dynamic pages (8 posts)

  1. scorpnetwork
    Member
    Posted 1 year ago #

    Hello,

    first of all, thanks for your plugin and your support.

    Now to my problem... I have a couple of dynamic WP Pages, which pull data from non-wp tables and show them. Like browsing a videos/books/games database which gets managed through a custom CMS.
    Since the shown data has nothing to do with WP and WP just loads the same page over and over again, there are no real title / description tags to show for your plugin.
    Now I would like to know which filters / actions i have to call from my functions.php to give your plugin the data for Meta Description.

    Thanks for your help in advance.

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

  2. Hassan
    Member
    Posted 1 year ago #

    Have you looked here?

  3. scorpnetwork
    Member
    Posted 1 year ago #

    This seems to be exactly what I was looking for.
    Thank you, thank you, thank you!!!

  4. scorpnetwork
    Member
    Posted 1 year ago #

    Ok this seems to be the answer to my question, but I am expiriencing problems with the API functionality.

    using this function to use a custom meta desc for my dynamic content pages:

    function yoastMetadesc($defaultMeta) {
    	switch($pagename){
    		case "xyz":
    			$x = ($wp_query->query_vars["x"]) ? $wp_query->query_vars['x'] : "x";
    			switch($x){
    				case "y":
    					return "123";
    				break;
    				default:
    					return "custom default desc";
    			}
    		break;
    		default:
    			return $defaultMeta;
    	}
    }
    add_filter( 'wpseo_metadesc', 'yoastMetadesc', 10, 1 );

    My problem now is that my custom meta desc only gets shown on the frontpage. there is no meta desc inside my blog postings or on my dynamic pages :( Only if I enter something manually inside the meta desc box widget inside on the "edit page" page. shouldnt it display the excerpt if I dont enter something manually?

    All templates use the same header.php, which calls wp_head(), so this is not the problem.

    Can somebody tell me what the problem is? Why isnt the meta desc populating inside my blog postings?

  5. jrf
    Member
    Posted 1 year ago #

    What are your settings on the SEO->Titles & Meta page ?
    If the meta description box there is empty, no meta description will be added and the filter will not be called/run.

  6. scorpnetwork
    Member
    Posted 1 year ago #

    Hmmmm, not sure if this is what I want to achieve...

    On articles, I want the articles excerpt to be the meta description (which is the default behavior of this plugin AFAIK). On Pages, it should be the custom meta description, which I want to define via the function posted above.

    I now filled the fields you mentioned with default meta descriptions & titles, but they are now shown on every article/page, instead of the excerpt.

    What am I missing?

  7. jrf
    Member
    Posted 1 year ago #

    I'm not sure I understand completely what's going on now. Are you using the %%excerpt%% variable or not ? If you're unclear on how to fill in the templates, have a look at the Help tab.

    Otherwise, if that's not the issue, could you show me a screenshot of what you've entered in the SEO->Titles & Meta's settings now ?
    And may be give me a link to one of the offending pages/posts ?

  8. scorpnetwork
    Member
    Posted 1 year ago #

    No no, the problem was something different, but I managed to fix it now... I removed the default parameter from the function and used the global $pagename var - now it works.

    %%excerpt%%

    This one solved my problem for the articles tho - big thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic