How can I use default CPT templates from sub-folder?

I think you should use single_template filter hook to load your template from a subdirectory. The full code will be like below- function the_dramatist_get_custom_post_type_template($single_template) { global $post; if ($post->post_type == ‘your_post_type’) { // Your post type directory with the post type template file name $single_template = dirname( __FILE__ ) . ‘/post-type-template.php’; } return $single_template; } … Read more

Trying to create a template without navigation and footer

If you take a look into the codex page for get_header() function, you will notice that WordPress automatically adds a header- prefix to your call. For example, using this: get_header(‘sample’); Will search for the header-sample.php file. So, in your case, you should name your header file header-headerremoved.php and then call it the following way: get_header(‘headerremoved’);

get_header(), get_footer() from plugin template

Old question, but maybe my answer will help someone. Short answer is: use load_template() function with full file server path as first argument passed to it. Long answer: get_header() using the function locate_template() which uses the function load_template() which uses the function require_once(). Thus, to load the header layout from a plugin or any other … Read more

How to use index.php as a template for archives?

I haven’t tested this but in your archive.php file in the child theme use the following command to output the index.php file contents. <?php get_template_part( ‘index’ ); ?> This way you can have all the code in your index.php file but use it elsewhere preventing the duplication. If you don’t want to create an archive.php … Read more

Taxonomy term page going to 404

Following @CraigWayne’s suggestion to use Query Monitor… Message: “Use of undefined constant term_name – assumed ‘term_name’”. Count: 1. Location: wp-content/themes/elegant/taxonomy-source.php:38. Caller: wp-includes/template-loader.php wp-includes/template-loader.php:74. Component: Core. >>>>> Line 38 in taxonomy-source.php included “” it was objecting to term_name in my taxonomy-source theme file; I changed it to $term = get_queried_object(); followed by name; ?> The takeaway … Read more

Is it possible to register a new template file?

I would strongly suggest you use a WordPress page template. At the top of dashboard.php: <?php /** * Template Name: Dashboard */ Now create a page called “Dashboard” and assign it the dashboard template. This way you’re not loading WordPress yourself (nearly always bad) & WordPress & all your plugins will function as normal (creating … Read more

How can I add text to a specific ‘Edit Page’?

To do this you would indeed have to include some code in the functions.php of your theme. You can use admin_notices to add a note to this specific page like this: add_action( ‘admin_notices’, ‘wpse332074_donotedit’ ); function wpse332074_donotedit () { $screen = get_current_screen(); if ($screen->post_type == ‘page’) { $variable = $_GET[‘post’]; if ($variable == id_of_page_as_integer) { … Read more

How to create a post template with two sidebars

If you add sidebar-sidebaraleatorio.php and sidebar-sidebarrecomenda.php sidebar templates to your (child) theme directory, you can then call them with get_sidebar() function. Like so get_sidebar(‘sidebaraleatorio); and get_sidebar(‘sidebarrecomenda);. You can read more about sidebars from the Developer Handbook > Sidebars.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)