• I am trying to find out where I would place the array of parameters for a custom sort.

    Right now I have I short code that displays a list of posts:

    $q = new WP_Query ( array('meta_key' => '_count-views_all', 'orderby' => 'meta_value_num' , 'posts_per_page' => '20', 'order' => 'DESC') );
    
    	$list = '<ul class="recent-posts">';
    
    	while ($q->have_posts()) : $q->the_post();
    
    		$list .= '<li>' . get_the_date() . '<a href="' . get_permalink() . '">' . get_the_title() . '</a>' . '<br />' . get_the_excerpt() . '</li>';
    
    	endwhile;
    
    	wp_reset_query();
    
    	return $list . '</ul>';

    , but I would prefer to have this formatted like the theme. So, I want to place the it within the theme query instead of its own query like this.

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter michaeljmac

    (@michaeljmac)

    Just as a note, I tried to do a simple url insertion, but it didn’t work and just continues to sort by date.

    ?meta_key=_count-views_all&orderby=meta_value_num&order=DESC

    Thanks again!

    Where should I put the sort codes the sort codes to change the menu of mio theme … actually I want to change the menu/page colors …. is it possible…………

    Can I use shortcodes or anything to change the menu colors of the menu/other part..

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom Sort Code’ is closed to new replies.