WordPress.org

Ready to get started?Download WordPress

Forums

WordPress SEO by Yoast
Issues With og:title in CPT (5 posts)

  1. UsagiYojimbo
    Member
    Posted 2 years ago #

    Hi to all,

    Since the last update, I experience issues with og:title for custom post type. Before the update, the og_title use to show wp_title(), but since yesterday, it shows a default sentence for all custom post type :
    Example.com - a website using WordPress, while the title shown in <title></title> is still ok.

    Any suggestions ?

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

  2. UsagiYojimbo
    Member
    Posted 2 years ago #

    Precision :
    Wordpress 3.4
    Wordpress SEO 1.2.3
    More Types 1.2

  3. UsagiYojimbo
    Member
    Posted 2 years ago #

    I hacked the plugin and modified class-open-graph.php this way :

    public function og_title() {
    		$title = $this->title('');
    <strong>		if ( is_singular() ) {
    			global $post;
    			$title = $post -> post_title;
    		}</strong>
    		echo "<meta property='og:title' content='".esc_attr( $title )."'/>\n";
    	}

    Seems to work now. But I don't like hacking plugins

  4. wattssw
    Member
    Posted 2 years ago #

    That code gave me an error.

    Here's my solution, seems to work perfect:

    public function og_title() {
    		$title = $this->title('');
    		echo "<meta property='og:title' content='".esc_attr( get_the_title() )."'/>\n";
    	}
  5. UsagiYojimbo
    Member
    Posted 2 years ago #

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.