page template
-
Hello,
I use custom page templates, when I want to create a new article it does not offer me a page template, I have added in my page:/*
Template Name: My Template
Template Post Type: post, page, product
*/If I go to my non-default wordpress articles, my personalized template appears.
Thank you
-
Is it not offering you the template metabox at all? or is it just not showing this specific “My Template”? Wanting to make sure you have “Page Attributes” selected with your post type settings.
I only have article attributes displayed with an order of 0, in my WordPress article pages it offers me the default template and my custom page.
Can you visit your tools area of the CPTUI admin menu, and copy/paste the blob of content on the right hand side of the “Post Types” tab? I want to see if I can identify any outstanding issues with post type configuration.
{“immobiler”:{“name”:”immobiler”,”label”:”Immobiliers”,”singular_label”:”Immobilier”,”description”:””,”public”:”true”,”publicly_queryable”:”true”,”show_ui”:”true”,”show_in_nav_menus”:”true”,”delete_with_user”:”false”,”show_in_rest”:”true”,”rest_base”:””,”rest_controller_class”:””,”has_archive”:”false”,”has_archive_string”:””,”exclude_from_search”:”false”,”capability_type”:”post”,”hierarchical”:”false”,”rewrite”:”true”,”rewrite_slug”:””,”rewrite_withfront”:”true”,”query_var”:”true”,”query_var_slug”:””,”menu_position”:””,”show_in_menu”:”true”,”show_in_menu_string”:””,”menu_icon”:”dashicons-admin-home”,”supports”:[“title”,”editor”,”thumbnail”,”page-attributes”,”post-formats”],”taxonomies”:[“type_de_biens”],”labels”:{“menu_name”:””,”all_items”:””,”add_new”:””,”add_new_item”:””,”edit_item”:””,”new_item”:””,”view_item”:””,”view_items”:””,”search_items”:””,”not_found”:””,”not_found_in_trash”:””,”parent_item_colon”:””,”featured_image”:””,”set_featured_image”:””,”remove_featured_image”:””,”use_featured_image”:””,”archives”:””,”insert_into_item”:””,”uploaded_to_this_item”:””,”filter_items_list”:””,”items_list_navigation”:””,”items_list”:””,”attributes”:””,”name_admin_bar”:””,”item_published”:””,”item_published_privately”:””,”item_reverted_to_draft”:””,”item_scheduled”:””,”item_updated”:””},”custom_supports”:””}}
If this is the post type you’re wanting to use the custom template with, you’re going to need to amend that header to this:
/* Template Name: My Template Template Post Type: post, page, product, immobiler */That way your post type slug gets listed and the WP admin area will pick up that it has a custom template available to it.
Thank you
Welcome.
Good evening,
I have one more question, I am using the OceanWP theme and when I create content using my custom page, I no longer have the theme options that are at the bottom of the page, any idea?Overall no, as those could be coming from anywhere.
Are these theme options something on the admin side when editing the post? or is it something output when viewing on the frontend? If you know for sure it’s something coming from OceanWP theme, their support may be able to more readily help with this question.
Hello,
The problem is on the administrator side and only on the personalized page, I will ask the question on the OceanWP forum.
Thank you for your replyYou’re welcome
Hello,
I wanted to ask you another question before making the request to OceanWP, when I use my personalized page with the articles and the theme pages the theme options are present, it only disappears when I use the section that I ‘ve created with CPT UI, is there a connection to be made at the configuration level, I have the impression that it considers that this page is not part of my theme.
cordiallyHello,
OceanWP answered me and provided me with some code to add to function.php, it works.
Thank youNot sure what section you mean with “the section I’ve created with CPTUI” since we don’t do anything special or custom with the post editor screen. Any metaboxes shown on the screen for the editor screen are dependent on what registration attributes you save for the post type, and they all come from WordPress core.
Anything else on the screen is going to be from other plugins or the active theme, and not all of them may be registered to be used with your post type. Really depends on the plugin(s) and theme and their settings for where to register their custom code like which post types to support. Many tend to offer settings to add post type support, some just register for all public post types.
For information, I added this code in function.php so that the theme options appear in the custom page I had created for use with CPT UI.
Thank you/** * Add the OceanWP Settings metabox in your CPT */ function oceanwp_metabox( $types ) { // Your custom post type $types[] = 'your-post-type'; // Return return $types; } add_filter( 'ocean_main_metaboxes_post_types', 'oceanwp_metabox', 20 );
The topic ‘page template’ is closed to new replies.