How do I modify the Previous and Next Page posts on blog pages to include “previous” and “next” before the links?

You can do this very easily using the_post_navigation. The WordPress reference page for it has more information. the_post_navigation( array( ‘prev_text’=>__(‘Previous: %title’), ‘next_text’=>__(‘Next: %title’), )); That said, if you do want to continue using `wp_link_pages’ then, again, its WordPress resource is your friend, explaining the parameters and how to change them. Hope that helps!

Which template(s) to override to use a different sidebar for blog, single posts, categories, blog archive?

Thinking about this problem some more, and meditating on the WordPress template hierarchy below, I came up with a solution to my own problem. I found that if I looked at the left side of the template hierarchy diagram and found the page type I was interested in, I could then work my way as … Read more

Custom Taxonomy Theme file not routing correctly

The template isn’t determined by the URL, it’s taxonom-{taxonomy_slug}.php See here for the full template hierarchy: https://developer.wordpress.org/themes/basics/template-hierarchy/ And a visual representation: https://wphierarchy.com/ Final Note on Terminology There’s a difference between taxonomies and terms, and muddling the two words or always referring to them as taxonomies will get confusing very quickly. For example ‘accounts’ would be … Read more

plugin overwrites other plugin’s archive-.php file

A core contributor had mercy with me – and an answer: $post_type = get_post_type(‘tires’) is not the correct method to get the post type in a reliable way. Instead, you need to use is_post_type_archive(‘tires’) The correct function looks like this: // Template Logic function rg_wp_tires_template_logic($original_template) { if(is_post_type_archive(‘tires’) || (is_search() && $_GET[‘post_type’] === ‘tires’)) { if(file_exists(get_template_directory_uri() … Read more

How to add HTML to a template only when user is logged out/ not registered

First of all, your shortcode usage code is incorrect, correct code is: echo do_shortcode(‘[loginout_button]’); Now, if you want to echo the login/logout button only when user is not logged in, you can use the function is_user_logged_in(). There are two ways to do this 1). Conditional logic inside your shortcode. add_shortcode(‘loginout_button’,’add_loginout_button’); function add_loginout_button() { if ( … Read more