Skip Navigation

[Résolu] Need help getting theme options into custom post type

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 3 réponses, has 2 voix.

Last updated by Caridad Il y a 6 années et 7 mois.

Assigned support staff: Minesh.

Auteur
Publications
#281122

I'm using a premium theme called Smarty for a client. They sell proposals for cleaning services. There are going to be 30+ proposals. Each needs its own page. I didn't want to clutter up the standard Pages area, so I created a custom post type called Proposals.

Upon creating a new Proposal, I expected to see all the theme options (same as a standard page) in the editor, but they're missing. These are theme-related options like, Page Header Options, Page Slideshow, Page Layout Options, and more. Any idea how to include these in the Proposals cpt?

Thanks,
Eric

#281127

I understand these options are added by theme and I don't have it available for testing.

Can you share access details so I can take a look and suggest a solution?

Regards
Caridad

#281673

Does it make any difference is you enable the "page-attributes" feature for your Proposals custom post type?

#281677

There is a hook called 'rwmb_meta_boxes' where you can adjust the metaboxes to work with proposals too.

You can see how its used in the parent theme in the file lib/metaboxes-new.php

In theory, you should be able to add something like this to the child theme:

add_filter( 'rwmb_meta_boxes', 'proposals_meta_boxes', 20 );  // run after parent theme

function proposal_meta_boxes( $meta_boxes ) {
    foreach ($meta_boxes as &$meta_box) {
        if ( in_array( 'page', $meta_box['pages'] ) ) {
            $meta_box['pages'][] = 'proposals';
        }
    }
    return $meta_boxes;
}

The code looks if each meta box is used in pages, and adds proposals.

I wasn't able to test the code, but it should work with little modifications.

Please let me know if you are satisfied with my reply and any other questions you may have.

Regards,
Caridad