Which Template Page Should I Use?

you could always make a custom wp_query and put it in a template-custom.php. $the_query = new WP_Query( array( ‘post_type’ => ‘faqs’, ‘tax_query’ => array( array ( ‘taxonomy’ => ‘audiences’, ‘field’ => ‘slug’, ‘terms’ => ‘merchants’, ) ), ) ); while ( $the_query->have_posts() ) : $the_query->the_post(); // Show Posts … the_title(); endwhile; /* Restore original Post … Read more

archive_template override when no posts exist

One way to accomplish this may be to use the pre_get_posts to conditionally add the single_template and archive_template filters. namespace StackExchange\WordPress; /** * Add filters for `single_template`, and `archive_template` for the tutorial and * dashboard archives. */ function pre_get_posts( $query ) { if( is_singular() ) { $post_type = get_post_type(); if ( ‘tutorial’ === $post_type || … Read more

How to list articles by year based on url?

Avoid using query_posts() Please don’t use query_posts(‘posts_per_page=10’); in your date.php template file as it will override the main query instance and thus affect the main loop. This can truly ruin the day! If you need to modify e.g. the posts_per_page for the main date query, use the pre_get_posts action to modify the query variables, before … Read more

My archive-posttype.php template is not loading

as determined in the comments, the page URI is ?post_type=photos&genre=boudoir… The reason why “archive-{$post_type}.php” isn’t used in this case is because the page is a taxonomy archive and not a custom post type archive. WordPress is looking for taxonomy-genre.php instead of archive-photos.php, and not finding it, is defaulting back to good old archive.php. Here’s a … Read more

Increase 10 post limit per page

It seems your theme (or one of your plugins) has reduced the query to 10 posts per page.Otherwise, changing the option in the Settings page has to change the number of posts per page. Check code of your theme and remove posts_per_page parameter of queries (If queries have been modified, and this parameter was set). … Read more

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