-
AuthorPosts
-
July 29, 2014 at 3:50 pm #75036
How do I accomplish this? I tried adding
x_add_page_meta_boxes(); to the function that creates my other metaboxes in the backend, but no luck 🙁
Thanks in advance!!!!
July 30, 2014 at 12:11 pm #75457Sorry, to clarify:
I have a custom post type called ATVRental, and the back end editor treats it like a blog posting. I would like to have X and WordPress treat it as a page, so each individual rental post has its own X theme options. I’m looking through features.php and the post types but haven’t figured out how to accomplish this yet. (Have WordPress and X treat my custom post type as a Page instead of a post, or to get X to see the custom post type as a page)July 30, 2014 at 12:27 pm #75467Hi Dan,
Thanks for writing,
not quite sure if I understand your point, but I think you are referring to this http://codex.wordpress.org/Function_Reference/register_post_type
When you register a post type, you need to specify its capabilities parameter as page.
e.g.
register_post_type( 'your_custom_post_type', array( 'capability_type' => 'page', //ADDITIONAL ARRAYS ) );
Hope that helps
July 30, 2014 at 8:19 pm #75707Thank you that does point me in the right direction, I didn’t realize I could specify post / page.
I am still missing the metaboxes I am looking for – Specifically the ‘Page Settings’ Metabox with all the X settings.
Also the ‘Page Attributes’ is missing the [Template] option 🙂 Any thoughts on this one? and thanks again!
July 31, 2014 at 7:17 am #75948Hi Dan,
You can check the wordpress codex for all the parameters of register_post_type functions from here, http://codex.wordpress.org/Function_Reference/register_post_type and add_post_type_support here http://codex.wordpress.org/Function_Reference/add_post_type_support
'supports' => array( 'title', 'editor', 'thumbnail', 'revisions', 'sticky', 'page-attributes')
Additionally, X metaboxes are added for specific post type and stack, they will not be added to any custom post type
if you check
x/framework/functions/global/admin/meta/entries.php
you’ll get an idea of how and where those metaboxes were added.Like for the
x_add_page_meta_boxes
metabox function.you can see it has this parameter
$meta_box = array( 'id' => 'x-meta-box-page', 'title' => __( 'Page Settings', '__x__' ), 'description' => __( 'Here you will find various options you can use to create different page layouts and styles.', '__x__' ), 'page' => 'page', 'context' => 'normal', 'priority' => 'high',
Which means this metabox was added for “Page” post type only and not for all post type.
You probably need to enhance that functions parameter like changing
'page' => 'page'
parameter to'pages' => array( 'page', 'your_custom_post_type' ),
or copy and rename the metabox function and add it only to your custom post type.July 31, 2014 at 10:03 am #76015Thank you!!! That is what I was searching for. One issue is that now I have made the change to pages => array(‘page’, ‘mytype’),
I am getting this:
Notice: Undefined index: page in H:\ampps\www\wp1\wp-content\themes\x\framework\functions\global\admin\meta\setup.php on line 36
when edit an entry. I took a look at the setup.php but I don’t see a reference to page. If it’s something I can ignore when I turn debug mode off then I won’t worry about it.
Thanks again!!
August 1, 2014 at 12:24 pm #76499Hi Dan,
I’m sorry about the previous response, you’ll actually need to call that function a second time altogether. The WordPress add_meta_box function can only add a metabox to one post type.
I would recommend that you go to
x/framework/functions/global/admin/meta/entries.php
and copy the entire function that you wish to reuse over to your child theme. Then just adjust the parameters as needed. This is better than copying core files.For example, the code you’d copy to functions.php would look like this:
function x_add_custom_meta_boxes() { $meta_box = array( 'id' => 'x-meta-box-page', 'title' => __( 'Page Settings', '__x__' ), 'description' => __( 'Here you will find various options you can use to create different page layouts and styles.', '__x__' ), 'page' => 'your_post_type', /* other attributes */ ); x_add_meta_box( $meta_box ); } add_action( 'add_meta_boxes', 'x_add_custom_meta_boxes' );
-
AuthorPosts