Problem creating a custom category page with pagination

On request, a custom template does not mean custom query :-). As already mentioned, NEVER use query_posts, it breaks the main query object and page functionality, one of which is pagination. Many plugins and functions relies on the main query object, you break that, you break those functions as well. As this is a custom … Read more

Handling single.php in Multisite

I’m surprised get_current_blog_id() didn’t work, since that’s probably the best way to approach it. Always try doing a var_dump( $current_blog ) to make sure you’re testing for what you need. Edit (19 Aug 2015): Also, triple check that you know which header you’re expecting to see and that you’re making the change you want in … Read more

Dynamically Insert Image Into Stylesheet

Typically with themes that support custom styles/images, you define everything you can in your stylesheet, and then add the dynamic styles inline: .header { background-position: 50% 50%; background-repeat: no-repeat: background-size: whatever; } And in your templates: <div class=”header”<?php if ( $image ) printf( ‘ style=”background-image: url(%s);”‘, $image ) ?>> Title </div>

Define PHP variable from a seperate API if statement

Hi I’m the author of Multi Rating Pro. The simplest way to do this is to put this logic within the rating-result.php template file. You can call the API function passing in your own result_type and then check this in the template. if ( class_exists( ‘MRP_Multi_Rating_API’ ) ) { MRP_Multi_Rating_API::display_rating_result( array( ‘rating_item_ids’ => 1, ‘show_count’ … Read more

!= and !== both not always working? [closed]

This is actually not really a WordPress issue, but pure PHP. != compares two value and return true when the two values are not like the other. 0 != ‘0’ will return false because the values are like each other, the one being an integer value 0 and the other a string value of 0 … Read more

get_month_link uses what wordpress template?

get_month_link() doesn’t use any template. It just creates a link to date based archives. The actual template used is decided by a rather complicated template hierarchy system managed by Core. Essentially there is a cascading sequence of files that will be used if those files are provided by the theme: date.php archive.php index.php

Loop through custom posts by taxonomy and display the titles in a list, it is repeating 8 times

You’ve hard-coded the term into the second query. Of course you are seeing the same thing every time: $terms = get_terms( ‘model’, array( ‘orderby’ => ‘count’, ‘hide_empty’ => 0 ) ); if (!is_wp_error($terms)) { foreach( $terms as $term ) { // Define the query $args = array( ‘post_type’ => ‘peterbilt’, ‘tax_query’ => array( array( ‘taxonomy’ … Read more