• Resolved Tim Soholt

    (@soholt)


    I’m working on migrating my site to WordPress and I have one section of posts (FAQs in the theme I’m using) that the admin module utterly refuses to display the Metadata window for. It doesn’t even show up in Screen Options. I can edit the HTML files to include the metadata, but it’s annoying that it only seems to be for this one post category; otherwise Add Meta Tags works great. Anyone have any ideas?

    http://wordpress.org/plugins/add-meta-tags/

Viewing 15 replies - 1 through 15 (of 22 total)
  • Plugin Author George Notaras

    (@gnotaras)

    Hello Soholt,

    […] I have one section of posts (FAQs in the theme I’m using) […]

    […] it only seems to be for this one post category

    Could you provide some more details about what exactly these posts are? Especially, what “section of posts” and “post category” refer to? Do you mean a custom post type?

    By default Add-Meta-Tags (AMT) adds a box named “Metadata” in the screen where you edit the post. The post can be of type: post, page or any public custom post type.

    It is possible to manage the list of the post types which AMT should support (and consequently which post types should have a Metadata box) by adding the following piece of code in the functions.php file of your theme:

    function limit_metadata_to_post_types( $post_types ) {
        // ... process and return the $post_types array
        // ... or just return a custom array of post types
        return array( 'post', 'book', 'project');
    }
    add_filter( 'amt_supported_post_types', 'limit_metadata_to_post_types', 10, 1 );

    This example exists in the description page (Example 2).

    George

    Thread Starter Tim Soholt

    (@soholt)

    I’m actually a little unclear myself what differentiates these posts from the others. The theme (WordPress Theme 1361, if that helps) includes several different categories listed immediately under the “Dashboard” tab on the left of the admin interface with the stick-pin icon I associate with “posts.” The posts in question (the FAQ section of the theme) are all public, but I can’t figure out how they’re categorized or defined other than “a collection of posts accessed by a specific button or a specific menu option.”

    Plugin Author George Notaras

    (@gnotaras)

    Hi Soholt,

    includes several different categories listed immediately under the “Dashboard” tab on the left of the admin interface with the stick-pin icon I associate with “posts.”

    These must be custom post types.

    The posts in question (the FAQ section of the theme) are all public

    Add-Meta-Tags needs the ‘post type’ to be public. This has nothing to do with the status of the posts.

    Maybe you should contact the theme developer and ask what differentiates the ‘faq’ post type from the other post types on which the metadata box appears.

    As a quick workaround, could you paste the following code in your theme’s functions.php file and check if the Metadata metabox is displayed in the edit screen of FAQs?

    function limit_metadata_to_post_types( $post_types ) {
        array_unshift( 'faq', $post_types );
        return $post_types;
    }
    add_filter( 'amt_supported_post_types', 'limit_metadata_to_post_types', 10, 1 );

    Please note that I am wild guessing here. If the ‘Metadata’ box does not appear, then delete this code from functions.php.

    Please, let me know if it worked.

    George

    Thread Starter Tim Soholt

    (@soholt)

    Sorry, that completely breaks the theme. I get “Fatal error: Only variables can be passed by reference in /mnt/data/www/htdocs/dev.accessinn.com/wp-content/themes/theme1361/functions.php on line 92.” I think it might work if I can figure out what the theme is calling that post type.

    Plugin Author George Notaras

    (@gnotaras)

    Hey Tim, sorry for that. The code has a mistake in the ‘array_unshift’ statement. Correct code below:

    function limit_metadata_to_post_types( $post_types ) {
        array_unshift( $post_types, 'faq' );
        return $post_types;
    }
    add_filter( 'amt_supported_post_types', 'limit_metadata_to_post_types', 10, 1 );
    Plugin Author George Notaras

    (@gnotaras)

    Or alternatively:

    function limit_metadata_to_post_types( $post_types ) {
        $post_types[] = 'faq';
        return $post_types;
    }
    add_filter( 'amt_supported_post_types', 'limit_metadata_to_post_types', 10, 1 );
    Thread Starter Tim Soholt

    (@soholt)

    That worked great. Thanks!

    Plugin Author George Notaras

    (@gnotaras)

    What you need to find out is where the theme registers these custom post types, so as to figure out what is different about the FAQs.

    In the code above, ‘faq’ is a wild guess of the identifier of the FAQ post type. If the post type is named differently, it won’t work.

    Plugin Author George Notaras

    (@gnotaras)

    Ah, didn’t see your last message. Glad it worked.

    Now you need to test if a FAQ post can actually store custom metadata, by adding (for example) a custom description and checking out if it is added in the description metatag of that FAQ post. If not, then the post type has some deeper differences (maybe does not support custom fields) than the other post types.

    Thread Starter Tim Soholt

    (@soholt)

    I’ll get back to you tomorrow. Thanks for the help so far.

    Plugin Author George Notaras

    (@gnotaras)

    OK. I’ll be around for the next 4-5 hours.

    But there isn’t much more to say aboiut this issue, unless you provide some more details about the custom post types you use.

    I tried to do some research about the ‘WordPress Theme 1361’. Is it a free theme? Can it be downloaded?

    I’m mainly interested in checking if there is any issue in the way AMT supports custom post types.

    Thread Starter Tim Soholt

    (@soholt)

    I had more trouble than I should have finding the added metadata in the source code. It looks OK, though for some reason the saved keywords on the FAQ posts are maintaining their capitalization, while the rest of the pages and posts revert to all lower case when I save them.

    The theme is from template-help.com, and I believe it’s a pay product, unfortunately.

    Thanks for all your help!

    Plugin Author George Notaras

    (@gnotaras)

    I have no explanation for this. If the keywords are entered in the ‘keywords’ box of the Metadata area in the post editing screen, then, when the post (FAQ in this case) is saved, the keywords are sanitized. This process involves their conversion to lowercase. I cannot think of any reason that could possibly prevent it.

    Also, what would be useful to know about the theme is whether it contains those custom post types by design or they have been created manually. This piece of info would help you find where the custom post types are defined and check their properties.

    George

    Thread Starter Tim Soholt

    (@soholt)

    They were part of the theme.

    Plugin Author George Notaras

    (@gnotaras)

    I’d suggest scanning all the files of the theme (including subdirectories) for the following:

    register_post_type

    Also, the following page on the WordPress Codex contains all the properties a custom post type could have: http://codex.wordpress.org/Function_Reference/register_post_type

    Alternatively, since the theme is a paid product, I assume that you could ask its creators for support regarding the differences of the post types.

    George

Viewing 15 replies - 1 through 15 (of 22 total)

The topic ‘Metadata Window Not Appearing on Some Posts’ is closed to new replies.