Archive or taxonomy pages not working for custom post type
Archive or taxonomy pages not working for custom post type
Archive or taxonomy pages not working for custom post type
get_header() accepts an argument, using it you can call a different headers. The only thing that get_header() does, is to include in the template where is called the file ‘header.php’ from child theme (if present) or from theme. If you use the argument $name, like so: get_header( $name), the function will look for a file … Read more
When you make a page the page for posts, it’s no longer a “page” in the conventional sense. Refer to the Template Hierarchy for home page display- the quickest fix is to rename your blog template home.php, and WordPress will load that before index.php.
I would recommend having two static Pages for this arrangement: The static page to serve as the Placeholder for your site front page The static page to hold the content you want to display as an excerpt on the front page Then, in front-page.php, you simply query static page 2 above, and output post-excerpt and … Read more
You can make use of the frontpage_template filter to adjust where your template should be loaded from add_filter( ‘frontpage_template’, function ( $template ) { $locate_template = locate_template( ‘page-templates/front-page.php’ ); if ( !$locate_template ) return $template; return $locate_template; });
WordPress has a simpler function for what you’re trying to do, add_rewrite_endpoint. Additionally, the filter for a single post template is single_template, page_template fires on the page post type. function wpd_detail_endpoint(){ add_rewrite_endpoint( ‘detail’, EP_PERMALINK ); } add_action( ‘init’, ‘wpd_detail_endpoint’ ); function wpd_detail_template( $template=”” ) { global $wp_query; if( ! array_key_exists( ‘detail’, $wp_query->query_vars ) ) return … Read more
That’s not how you use get_theme_file_uri(); You need to specify the directory RELATIVE to your currently active theme’s directory. So for example, if your currently activated theme is rm-acf1, and all of your custom header CSS files are located in the subfolder hdr-styles. This is your theme directory: ./wp-content/rm-acf1/ This is your header styles directory: … Read more
No, don’t hardcode the ID’s for pages in your CSS. You might want to use the same styles elsewhere, or if the stylesheet is cached for users, they might not immediately see your changes you push up if you don’t version the stylesheet. Not only that it makes deciphering your styles just that much harder … Read more
The template hierarchy does not provide for archive index pages. This is an issue that was raised through a trac ticket, but that idea was scrapped and will never be implemented due to different theme stuctures across the board So the following will never exists natively Pages that lists all posts from a given taxonomy … Read more
You can certainly use Page Templates for that. They’re a specific type of template file that can be applied to a specific page or groups of pages. Plus, they can be stored in sub folders. All you need is to put something like this at the top of the template files: /** * Template Name: … Read more