How to remove the Template drop down, but keep Parent and Order

When you remove that box from admin (as you’ve written in the comment), you should be able to re-register that box with custom function (modified original) to render the box: if ( post_type_supports($post_type, ‘page-attributes’) ) add_meta_box(‘pageparentdiv’, ‘page’ == $post_type ? __(‘Page Attributes’) : __(‘Attributes’), ‘my_page_attributes_meta_box’, null, ‘side’, ‘core’); function my_page_attributes_meta_box($post) { $post_type_object = get_post_type_object($post->post_type); if … Read more

Can Page Templates be Applied to Archive and Post Templates?

If you would like all Post Types to have template selection functionality, please update to WordPress version 4.7. Quoted from the codex page linked above: Page Templates for Post Types Add support for post type templates. Add support for post type templates. By opening up the page template functionality to all post types, theme developers … Read more

Remove meta box for specific page

The is_page() conditional relies on the global $wp_query WP_Query object which isn’t set on the edit post page. We have some other options though… If we know the page ID we can test against $_GET: /** * Remove metaboxes * * @return void */ function wpse343020_remove_meta_boxes() { if( isset( $_GET, $_GET[‘post’] ) && 123 == … Read more

Programatically added attribute, set to ‘show on product page’ automatically. Woocommerce [closed]

It actually doesn’t matter because WooCommerce uses this, to display: $values = wc_get_product_terms( $product->id, $attribute[‘name’], array( ‘fields’ => ‘names’ ) ); However, if you don’t set the display to true, you’d have to add this code to your template files. You might have to do other things as well (styling, etc). If you just set … Read more

Change Order of Admin Posts Depending on Meta

Post list in admin (edit.php) use a normal WP_Query, just like frontend can be changed using pre_get_posts. add_action(‘pre_get_posts’, ‘reorder_my_cpt’); function reorder_my_cpt( $q ) { if ( !is_admin() || !$q->is_main_query() ) { return; } $s = get_current_screen(); // change ‘book’ with your real CPT name if ( $s->base === ‘edit’ && $s->post_type === ‘book’ ) { … Read more