Why is the custom taxonomy archive page redirecting me to a single post? [closed]

Taxonomy archive index pages for custom taxonomies are not rendered using archive-{taxonomy}.php, but rather, using taxonomy-{taxonomy}-{term}.php, which falls back to taxonomy-{taxonomy}.php, which falls back to taxonomy.php. Refer to the Template Hierarchy. WordPress interprets archive-{foobar}.php as archive-{post-type}.php, and would use that template to render the archive index for the foobar post-type. So, your artist taxonomy archive … Read more

Filtering WP_Query

I rewrote the code and now it works The loop: $args = array(‘post_type’ => ‘artist’); $wp_query = new WP_Query( array_merge( $args, array(‘nopaging’ => true) ) ); The filter: function theme_posts_orderby( $orderby, $query ) { if ($query->query_vars[‘post_type’] == ‘artist’) { // order artists by last name $orderby = “RIGHT(post_title, LOCATE(‘ ‘, REVERSE(post_title)) – 1) ASC”; } … Read more

how to make URL link query string

This is how I got it working: ADDED this to functions.php: function include_template_function( $template_path ) { global $wp; if ($wp->request == ‘state’) { $template_path = locate_template( array ( ‘state.php’ ) ); } return $template_path; } $state_name = $_GET[‘st’]; //this is added to use as a global variable ADDED THIS to header.php because WP thinks it’s … Read more

Remove category from query (show all posts in archive.php) pre_get_posts()

Just unsetting the cat variable probably isn’t enough. The pre_get_posts hook happens after the query variables have already been parsed. So there’s probably a tax_query with the taxonomy = category and the terms = your category. You’re already dumping the $query in your code, presumably for debugging. So, look at what you’re actually dumping. Do … Read more

Getting the author name on author archive page

I don’t know what are you trying to do with if-else statement, but to display author name with their published post link use this code: <span>Article posted by <?php the_author_posts_link(); ?></span> Tweak it according to your need. One more thing: You need to call the_author_posts_link() function within the while loop (Yes, the same while loop, … Read more

Archives for each category on WP Multisite

I thought I’d let you know how I resolved this. After some discussion with a colleague, he made the point that adding a trailing year to the url, doesn’t affect the page displayed (I haven’t had time to find out the rationale for this yet) so: /category/subcat/2011/ displays the same page as /category/subcat/ This meant … Read more

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