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

    (@gotcha5832)

    I found..

    function change_wpseo_opengraph_type(){
        if ( is_front_page() || is_home() )
          return 'website';
        elseif (is_singular() || is_category())
            return 'article';
        else
            return 'object';
    
    }
    add_filter('wpseo_opengraph_type', change_wpseo_opengraph_type );

    This is what I found more recently on the Yoast website. I’ve also modified it so that pages are properly set to og:type website, whereas posts are proerly set to og:type article. Using is_singular as in the prior comment would set both posts AND pages as og:type article which is not what I wanted for my purposes. Modify accordingly is you so choose.

    
    function yoast_change_opengraph_type( $type ) {
        if ( is_front_page() || is_home() || is_page() )
          return 'website';
        elseif ( is_single() || is_category() )
            return 'article';
        else
            return 'object';
    
    }
    add_filter( 'wpseo_opengraph_type', 'yoast_change_opengraph_type' );
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘property="og:type" content="article" on Category’ is closed to new replies.