Is it possible to have a template that works on multiple categories where the link address contains the specific category?

Why not using a meta field ? That way you can determine which template to use for specific category template. In your loop just get the current category that you are trying to load: if( have_posts() ) { while( have_posts() ) { the_post(); $meta_value = get_post_meta( get_the_ID() , ‘meta-field’, true ); if($meta_value == ‘template1’) { … Read more

Add archive/category results to single post page

Figured it out. A conditional in content.php in template-parts/ checked whether the content is_archive. I assume the functionality behind is_archive is whether the file was launched from archive.php. Since it wasn’t it didn’t fire. Final step was redirecting to a custom content-post-type.php in template-parts that doesn’t have the is_archive check. Seems like it all works … Read more

How to integrate single and archive templates for custom post type in any WordPress theme

Is there a way to use for example single.php base structure overriding only the inner content? The main content of pages and posts is output using the the_content() function. This can be filtered and changed by plugins using the the_content filter. However this only outputs the content entered into body of the editor. It does … Read more

How to customize taxonomy archive template files for subterms?

Strictly speaking, according to the Template Hierarchy, you cannot. Unfortunately taxonomy-$taxonomy-$term-$subterm.php is not provided for in default, so this file structure will not work. The best you can do here is taxonomy-$taxonomy-$term.php So for Thailand you will name your template as follows taxonomy-location-Thailand.php EDIT Just to add to my answer, the file structure that you … Read more

Pagination doesn’t function properly for archive of a custom post type set as the front page

Between my phone and work some errors creeped in, sorry about that. here is my revised answer. Hope this helps in solving your problem. PROBLEM 1 You should not name your template ‘archive-{$post_type}.php’ if it is a page template. This totally goes against the template hierarchy for pages, and that is why your static frontpage … Read more

Display custom post types in wp_list_pages

To simplify things, first make your archives actual Archives – not Pages. That will help you later on in listing the correct content. unregister_post_type(‘blog’); unregister_post_type(‘event’); unregister_post_type(‘news’); Unregistering the post type won’t delete any content, it will just ensure that when you re-register them, the settings will take effect. Tweak your register_post_type calls which should look … Read more

show ALL latest posts with archive.php on example.com/latest

All internal rules must point to index.php. This isn’t your theme’s index.php file, this is the main core WordPress bootstrap file. Rewrite rules set query vars, query vars get parsed into queries, those queries have template files associated with them depending on type. Internal rewrite rules never point directly to theme files. If you want … Read more

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