pre_get_posts conflict with archive posts

As your pre_get_posts function stands, you’ll have that conflict as you are using pre_get_posts very carelessly. pre_get_posts modifies the query variable object before the main query AND WP_Query is executed. So any changes in your function will influence both the main query and any custom query that uses WP_Query. That is why everything is haywire … Read more

Post archive for certain post format

Post formats are actually terms of the taxonomy post_format. I have done a post about this what taxonomies are and their hierarchies which you can check out here To get a list of all terms under the taxonomy post_format, simply use get_terms and var_dump() the result $terms = get_terms(‘post_format’,’hide_empty=0′); ?><pre><?php var_dump($terms); ?></pre><?php This will print … Read more

Blog pages show at most unrecognized by code

You must set your post counter outside your loop first before it will work. If you turn debugging on, you will get an undefined variable notice. You can do something like this just outside your loop before the loop starts $postvariable = 1; Alternatively you can make use of the build-in post counter, $wp_query->current_post. It … Read more

WordPress showing wrong category name

As far a I can understand you need to display the category name for the current page when viewing a category page. You can make use of the query variables to retrieve the category name, for example: $category = get_queried_object(‘cat’);  echo $category->name; EDIT A global check to see what is returned by the main query … Read more

Creating attachments archive in tags and categories

The WP_Query documentation on the codex specifically says: ‘attachment’ – an attachment. Whilst the default WP_Query post_status is ‘publish’, attachments have a default post_status of ‘inherit’. This means no attachments will be returned unless you also explicitly set post_status to ‘inherit’ or ‘any’. I am not sure why it was working before because this is … Read more

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