Sort order in get_posts [closed]

The problem here is not that the posts that are being wrongly displayed are displayed under the wrong category, it’s that they’re not actually in the right category. For example, the post “Supporting healthy eating choices” is displayed under “O” as it has the category “O”. Going to your backend and assigning the proper category … Read more

Grab next post title in archive page

This doesn’t seem terribly efficient but you could just look up the next/prev posts in the loop used to display the post then output the post titles in the nav calls. // loop if ( have_posts() ) : while ( have_posts() ) : the_post(); // … post display // next & prev post data $older … Read more

excludeCat function reverses order of blog posts

function exclude_category( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( ‘cat’, ‘-5377’ ); $query->set( ‘orderby’, ‘date’ ); $query->set( ‘order’, ‘DESC’ ); } } add_action( ‘pre_get_posts’, ‘exclude_category’ ); Use ASC or DESC for order. Add code to child themes functions file. Tested and works.

search.php is not generating the right results

Try adding the following code to the top of your search.php template below the get_header() call: <?php global $query_string; $query_args = explode(“&”, $query_string); $search_query = array(); foreach($query_args as $key => $string) { $query_split = explode(“=”, $string); $search_query[$query_split[0]] = urldecode($query_split[1]); } // foreach $search = new WP_Query($search_query); ?>

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