Understanding the WordPress template hierarchy

I watched a lot of courses about WordPress Development on Udemy. Also I’ve almost finished my “WordPress Development” track on Teamtreehouse, but I can’t understand one simple thing, because one course a little bit contradicts another. My question is about page.php, content.php and single.php. What is the best practice to use these files? For example, … Read more

WordPress not respecting template hierarchy (fetches index.php instead of single.php or page.php)

I’ve encountered a strange error while developing a custom theme. After finishing editing the template for a custom post type single view, I passed onto working at the template files for pages and I ealized that WordPress was actually pointing to index.php template file rather than page.php in my theme for generating the page appearance. … Read more

Custom post type and taxonomy permalinks – Structure

Been trying to get a nest of custom post type and taxonomy working (even took a look here) but couldn’t get it working 100%. Here is the thing, I created a custom post type texturas_temp and a custom taxonomy inside it categorias_texturas_temp. What I would like to do is to get this structure: /texturas_temp/ <- … Read more

Unable to include a template

On the home.php, which is in the same folder where style.css is kept I am try to call a template: <?php get_template_part( ‘template-parts/content’, ‘home-default’ ); ?> template-parts is a folder which is in the root folder same where we have style.css, like – theme-directory — template-parts — content-home-default.php — style.css — home.php Template is: content-home-default.php … Read more

Where to put my global functions?

I currently have a global function in my functions.php file ein_error_log($message) { //push out $message to file… } But I want to start using it in my MU-Plugin directory and it doesn’t know it exists. So I assume it’s because MU-Plugins folder is read before the theme folder in WordPress’s hierarchy, which makes sense. But … Read more

Any tag pagination page (except the 1st page) loads index.php template instead of tag.php

Created my first custom theme from scratch and I’m trying to do a listing of all posts with the same tag. In tag.php I display all posts with that specific tag via a WP_Query and I’m trying to implement the pagination for that listing (using paginate_links()). Page links seem to be outputted correctly. Also the … Read more

How can a Theme Contain no Header File or Footer File?

Some themes that I have seen such as the (famous) thesis or even a few other not so famous themes have just an index.php (which has nothing in it), functions.php (call’s their framework) and a style.css – and of course the comments.php. These themes don’t exactly show you where they are storing their CSS – … Read more

Displaying all Video Post Formats to Page

I am creating a video-archive page for all the posts_format with video. Currently, I have: <?php $format = has_post_format(‘video’, $post_id); ?> <?php if($layout != “fullwidth”) { echo ‘<div class=”page_inner”>’; } if (have_posts()) : while (have_posts()) : the_post(); vntd_blog_post_content(); endwhile; This is not working, but I do not think I’m far off. What am I doing … Read more