• Resolved sb0k

    (@sb0k)


    Hi,
    i would explain my situation with your plugin and ask you how to resolve some issues.

    I have some custom post type on my site, and everyone has only the title support, so i can’t use the plugin. I read that i can solve it by enabling the editor support, useless in my situation.

    In my cpt the default editor is replaced with another editor field, where’s placed the content of the article, and the thumbnail is replaced with a image field.

    There’s a way to replace the content of the opengraph data with the content of th custom fields ?

    thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Sybre Waaijer

    (@cybr)

    Hi @sb0k,

    The editor requirement has been set for compatibility and usability reasons. Almost always post types without an editor aren’t public, or are used in special scenarios.

    You could add the code below to your theme’s functions.php file to limit or increase post type support for the SEO meta box.

    Please be aware that the code is not tested, and might contain typos.

    Use either 1 or 2.
    In rare cases, if it still doesn’t work, use 3 in combination with 1 or 2.

    1. Remove editor requirement (at own risk).

    add_filter( 'the_seo_framework_custom_post_type_support', function() {
    	return array( 'title' );
    });

    2. Add specific post type support for TSF.

    add_post_type_support( 'my_post_type', 'autodescription-meta' );
    

    3. If all else fails, adjust ‘my_post_type’ in the code with the post type slug. Use this in combination with either 1 or 2.

    add_filter( 'the_seo_framework_supported_post_type', function( $supported = false, $post_type = '' ) {
    	// Return default if supported.
    	if ( $supported )
    		return $supported;
    
    	// Return my own post type name to be supported.
    	if ( 'my_post_type' === $post_type )
    		return $post_type;
    
    	// Return default.
    	return $supported;
    });

    I’ve added a GitHub issue for a Free Extension that would allow the code above to be accessible from a user interface:
    https://github.com/sybrew/the-seo-framework/issues/86

    I hope this helps. If you still require assistance, do let me know!

    Thread Starter sb0k

    (@sb0k)

    Hi @cybr,
    thank you, i really appreciate your reply.
    About the your solutions, i solved my issue with the second without disabling editor requirement, i think the simplest.
    do you have any suggestions about the opengraph content replace ?

    thank you

    Plugin Author Sybre Waaijer

    (@cybr)

    Hi @sb0k,

    I’d assume you wish to alter the Open Graph fields apart from the SEO fields?

    In 2.9.0 it’s planned to have a tabular SEO metabox, which allows for extending the metabox to anyone’s liking.

    Whether Open Graph specific fields will be added through TSF itself or a free extension is still to be determined. But I think I should start awarding users using the Extension Manager :).

    But this certainly is on top of the list after the 2.9.0 release.

    DIY
    The /inc/classes/render.class.php contains all front-end output function containers.

    In there, the following filters are placed for Open Graph:

    the_seo_framework_ogdescription_output
    the_seo_framework_oglocale_output
    the_seo_framework_ogtitle_output
    the_seo_framework_ogimage_output
    the_seo_framework_ogsitename_output

    They all have the same structure, where ‘filter_name’ is any of the above:
    add_filter( 'filter_name', function( $current_output = '', $post_or_term_id = 0 ) { return $current_output; }, 10, 2 );

    I’m not sure which custom fields you use, but I’m pretty sure there’s documentation to be found on those ??

    Best of luck! If you still require assistance, feel free to ask!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom post type , custom fields and opengraph data’ is closed to new replies.