Jump to content
yemingyuen

Mutiple Custom Post Type Page Templates

Recommended Posts

yemingyuen    0
yemingyuen

hi there,

 

Every time i try to enter a third custom post type, the page option setup screen fails to save the options for the last custom post type. I'm not a php person, but this is the code thats worked the best so far, i have a feeling that im defining the variables wrongly. Could you point me in the right direction?

 

Thanks!


// PageLines: Add Custom Post Type (CPT) to Page Options
add_filter( 'postsmeta_settings_array', 'pl_control_cpt' );
function pl_control_cpt( $array ) {
//1st one
$cpt = 'event'; //EDIT THIS FOR YOUR CUSTOM POST TYPE NAME
global $metapanel_options;
$array[ $cpt ] = array(
'metapanel' => $metapanel_options->posts_metapanel( $cpt ),
);
$array[ $cpt . '_archive' ] = array(
'metapanel' => $metapanel_options->posts_metapanel( $cpt . '_archive' ),
);

$cpt = 'night'; //EDIT THIS FOR YOUR CUSTOM POST TYPE NAME
global $metapanel_options;
$array[ $cpt ] = array(
'metapanel' => $metapanel_options->posts_metapanel( $cpt ),
);
$array[ $cpt . '_archive' ] = array(
'metapanel' => $metapanel_options->posts_metapanel( $cpt . '_archive' ),
);

$cpt = 'artist'; //EDIT THIS FOR YOUR CUSTOM POST TYPE NAME
global $metapanel_options;
$array[ $cpt ] = array(
'metapanel' => $metapanel_options->posts_metapanel( $cpt ),
);
$array[ $cpt . '_archive' ] = array(
'metapanel' => $metapanel_options->posts_metapanel( $cpt . '_archive' ),
);

return $array;
}

Share this post


Link to post
Share on other sites
greenfly    230
greenfly

Looking into this for you 


The answer to many issues can be found by searching in the forum before posting as someone else  may very well have had the same problem before you have.  Also, reading the documentation can help you gain a good understanding of how everything works. 

 

Please do not send me private messages. Occam's razor - The principle states "Keep things simple!"

Share this post


Link to post
Share on other sites
James B    436
James B

Unfortunately the moderating team are unable to assist with php solutions directly. We will leave this thread open however, if Martin is able to get a response from one of our developer team and advise directly they'll post here for you. Otherwise maybe another member of the developer group can provide further assistance on this for you.


Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Similar Content

    • art23130
      By art23130+
      I have uploaded a file shoing missing sections for Custom Post Type
      It is OK for categories and tags but not for a single post types. 
      This is the link. 
      https://www.geoinformation.com/geocode_library/10-10570-rsg-2016-003/
      Any idea?
      thanks 
      Binder1.pdf
    • PeriniNero
      By PeriniNero+
      We are building a Custom Post Type with Custom Fields and Custom Taxonomies.
      The only thing we dont understand is how to embed the Custom Fields including header tags and stuff in the Postloop (now we use a text-box below the postloop section but also SEO wise this is not best pratice).
      So we thought to copy the dms Postloop section to our child theme and rename this, to add an extra Postloop section to our theme. Is this the way?
      What exactly to adjust in those 3 files class.posts.php, section.php and style.less (at this point we know how to change the thumb LOL) and where to add the Custom Fields shortcodes?
      Thanks.
    • Audun MB
      By Audun MB+
      I'm using plugins such as Events Manager and WP Glossary. Basically I need to edit the meta information and the breadcrumb for the custom post types Event and Term. The plugins instruct me to add a single-event.php and single-glossary.php in my (child) theme.
      What should I use as a basis for these files? Can I use the templates in the Framework main theme as a basis (tpl-a.php)? Or should I use the whole page.php file?
       
    • Claude203
      By Claude203
      Hi, the Modal Popup is working fine. But whenever I look on the DMS Editor, that section is gone. It was placed at the bottom of the Footer. The first time it happened, I thought maybe I had inadvertently deleted it, or not saved properly. So I re-created another one. And so on. Then I finally realized it was working after all. But now I'm wondering if there are several of my popups in place, all of them the same, yet none of them visible, but yet all of them working. I've tried adjusting/saving into a new page template. I've tried turning on/off the DMS Editor. Still can't find a trace of the Modal Popup section, yet I know it works because I used Safari and Firefox to confirm, even on a different computer. Thanks for any help/insight you might provide.
       
      http://www.blackfives.org
    • ketri
      By ketri
      Hello,

      When I select a page template for a custom post type page, it also selects the same template for the children of this custom post type. 
      I want to have my custom post type template as a heavily customized loop that I've developed myself, and the children (they are articles) as a completely another template.
       
      Is there a function that would allow me to select different templates for them on DMS?

      Thank you very much in advance.
×