Custom archive pages without “the loop”

You should filter the default $query via callback hooked into pre_get_posts: function wpse108983_filter_pre_get_posts( $query ) { // Make sure we’re targeting // the main loop query, and // only in the archive context if ( $query->is_main_query() && is_archive() ) { // Add your query modifications here // For example, to sort by date: $query->set( ‘orderby’, … Read more

pre_get_posts works in post type archive but not in single post

The next_post_link() and previous_post_link() functions do not use the same query that ‘pre_get_posts’ affects. They use their own custom queries. You have to use other filters to affect them. Utimately, the get_adjacent_post() function does the bulk of the work for the next_post_link() and previous_post_link() functions. Here is part of that function: $adjacent = $previous ? … Read more

Why does my URL keep returning 404 error code?

Here is the solution of my problem, thanks to @Milo: function wpa_date_archive_post_types( $query ){ if( $query->is_main_query() && $query->is_date() ): $query->set( ‘post_type’ , array( ‘movie’ ) ); $query->set( ‘year’ , 0 ); $query->set( ‘tag’ , ‘1994’ ); $query->set( ‘post_status’ , array( ‘publish’ ) ); endif; } add_action( ‘pre_get_posts’, ‘wpa_date_archive_post_types’ );

Show Daily Archives after specific dates

do so like this add_filter( ‘getarchives_where’, ‘my_archives_filter_function’, 10, 2 ); create function function my_archives_filter_function($text, $r) { return “WHERE post_type=”post” AND post_status=”publish” AND post_date >= ‘2013-08-01′”; }

How to change archieve frequency of the media file in uploads folder for wordpress blog

Assuming you want to set your weekly changing subdirs like, eg ‘2013/W35’ /where 35 stands for 35th week of 2013 (‘W’ param of php date() function), you can use: add_filter(‘upload_dir’, ‘set_folder_to_week’, 999); function set_folder_to_week ( $upload_data ) { $y = date(‘Y’); $w = ‘W’ . date(‘W’); $subdir = “/$y/$w”; $dir = $upload_data[‘basedir’] . $subdir; $url … Read more

Custom Taxonomy List with Children

Your code works perfectly in a custom taxonomy template file. CASE 1 You’re trying to use this code in a single page or something else and it doesn’t work because the object returned from get_queried_object() isn’t a taxonomy. The function get_queried_object() return the currently-queried object. So, if you need a Taxonomy Object you have to … Read more

Archive filtering

You need a tax_query argument to WP_Query, if I am reading your question correctly. $my_query = new WP_Query( array( ‘tax_query’ => array( array( ‘taxonomy’ => ‘category’, ‘field’ => ‘id’, ‘terms’ => array($featured_ID,$curr_cat->cat_ID), ‘operator’ => ‘AND’ ) ) ), ‘posts_per_page’ =>8 ) ); Untested, but I think that should be close. Also, where does global $cat; … Read more

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