Missing Page Settings for custom post (page) (X)

Hello,

I have created a custom post type in a child theme of x that is supposed to act as a page (maybe my trouble is initiated already here…) This is my code in functions.php:

// Creates mytypes Custom Post Type
function mytypes_init() {
    $args = array(
        'label' => 'My Types',
        'description' => 'All of My Types',
        'public' => true,
        'show_ui' => true,
        'capability_type' => 'page',
        'hierarchical' => true,
        'rewrite' => array('slug' => 'mytypes'),
        'query_var' => true,
        'menu_icon' => 'dashicons-location-alt',
        'has_archive' => false,
        'taxonomies' => array( 
            'category',
            'post_tag' 
        ),
        'supports' => array(
            'title',
            'editor',
            'excerpt',
            'trackbacks',
            'custom-fields',
            'comments',
            'revisions',
            'thumbnail',
            'author',
            'page-attributes',)
        );
    register_post_type( 'mytypes', $args );
}
add_action( 'init', 'mytypes_init' );

I have also managed to use the templates from x on these custom posts/pages.

However, when launching Cornerstone, I see the
“header class=“x-header-landmark””…"/header"
with a “BLOG” title on the left and some breadcrumbs on the right. (It doesn’t matter wich page-template I choose, I get this on every one.)

I don’t want this and understand that I can hide it under Page Settings. My problem is that I don’t have any Page Settings when editing in “Wordpress core”. I do have it under the “normal” pages though.

So where did I go wrong? Am I trying to achieve something that is not possible, or have I just missed something important when creating my custom post type?

I appreciate any help!

I almost just logged the same issue, but then figured it out.

I added a new template to my child theme, and in there set the “Template Post Type” it applies to, to include my custom post type

Thank you, but that I have already done. And I can work with the templates. However, the Blog header and breadcrumbs still remains. That is my problem… :slight_smile:

Hi there,

Thanks for posting in.

The Page Settings section is added by X theme and not by Wordpress, and it’s only added to page types. But I’m not sure if it’s applicable to custom post types with page capability. You’ll find the existing codes in \framework\functions\global\admin\meta\entries.php

You can simply copy some code and enhance it like this to your child theme’s functions.php

add_action('init', 'custom_post_type_page_settings', 999999);

function custom_post_type_page_settings () {
  $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'        => 'mytypes',
    'context'     => 'normal',
    'priority'    => 'high',
    'fields'      => array(
      array(
        'name' => __( 'Body CSS Class(es)', '__x__' ),
        'desc' => __( 'Add a custom CSS class to the <body> element. Separate multiple class names with a space.', '__x__' ),
        'id'   => '_x_entry_body_css_class',
        'type' => 'text',
        'std'  => ''
      ),
      array(
        'name' => __( 'Alternate Index Title', '__x__' ),
        'desc' => __( 'Filling out this text input will replace the standard title on all index pages (i.e. blog, category archives, search, et cetera) with this one.', '__x__' ),
        'id'   => '_x_entry_alternate_index_title',
        'type' => 'text',
        'std'  => ''
      ),
      array(
        'name' => __( 'Disable Page Title', '__x__' ),
        'desc' => __( 'Select to disable the page title. Disabling the page title provides greater stylistic flexibility on individual pages.', '__x__' ),
        'id'   => '_x_entry_disable_page_title',
        'type' => 'checkbox',
        'std'  => ''
      ),
      array(
        'name' => __( 'One Page Navigation', '__x__' ),
        'desc' => __( 'To activate your one page navigation, select a menu from the dropdown. To deactivate one page navigation, set the dropdown back to "Deactivated."', '__x__' ),
        'id'   => '_x_page_one_page_navigation',
        'type' => 'menus',
        'std'  => 'Deactivated'
      ),
      array(
        'name' => __( 'Background Image(s)', '__x__' ),
        'desc' => __( 'Click the button to upload your background image(s), or enter them in manually using the text field above. Loading multiple background images will create a slideshow effect. To clear, delete the image URLs from the text field and save your page.', '__x__' ),
        'id'   => '_x_entry_bg_image_full',
        'type' => 'uploader',
        'std'  => ''
      ),
      array(
        'name' => __( 'Background Image(s) Fade', '__x__' ),
        'desc' => __( 'Set a time in milliseconds for your image(s) to fade in. To disable this feature, set the value to "0."', '__x__' ),
        'id'   => '_x_entry_bg_image_full_fade',
        'type' => 'text',
        'std'  => '750'
      ),
      array(
        'name' => __( 'Background Images Duration', '__x__' ),
        'desc' => __( 'Only applicable if multiple images are selected, creating a background image slider. Set a time in milliseconds for your images to remain on screen.', '__x__' ),
        'id'   => '_x_entry_bg_image_full_duration',
        'type' => 'text',
        'std'  => '7500'
      )
    )
  );

  x_add_meta_box( $meta_box );
}

Please pay attention to 'page' => 'mytypes', and change it accordingly. There is no guarantee it will work and we can’t provide further enhancement and customization, but you’re free to modify it :slight_smile:

Thanks!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.