Support » Themes and Templates » Sort one catagory by ('meta_value_num') and ('order' => 'DESC') in

  • Resolved w12gilbert


    Hello everyone,

    First off I would like to thank all the contributors and authors of wordpress (awesome script) and hope to get some help with a modification.

    I am feebly tring to use my wordpress realtor website to also hold a video contest

    I am using Genesis parent theme with Agent Press child theme. I would like to be able to sort one catagory such as (contest videos or videos) desending by order of the number of facebook likes counts and leave the rest of the catagories to be sorted how ever they are being handled in the Genesis theme.

    I have installed a plugin called “Facebook Like Posts Order”
    that adds meta data to my post with a custom field “facebook_likes”.

    I am trying to dive into the the theme code to accoplish this.

    So far I think I need to either use a query that is like , (please pardon the non-programming languege here)

    If cat = “contest video” or “video” or what ever catagory then

    $query = new WP_Query( ‘post_type’ => ‘contest videos’, ‘orderby’ => ‘meta_value_num’, ‘meta_key’ => ‘face_book_likes’, ‘posts_per_page’ => ‘5’, ‘order’ => ‘DESC’ );

    Else the original query from the theme what ever and where ever that is.

    Or it looks like I could create a Template called Cat “contest_videos” or “video”.php

    My Agent Press child theme has the following templates

    Multi-Agent Page Template
    Theme Functions

    Genesis parent theme has the following templates
    404 Template
    Archive Page Template
    Blog Page Template
    Main Index Template
    Page Template
    Single Post
    Theme Functions

    Based on the wordpress template hierarchy found at I think I would need to modify the code or query on my “Archive Page Template” but I am not sure.

    Any body out there that can point me to the theme and code to modify to get my “video Contest” catagory to sort different from the others.

    Thanks and the relevant templates are below. Sorry for being so green with puters.

    wordpress rocks
    my website, which is under contruction still, is at

    the folloing is the templates

    Main Index Template(parent theme- Genesis)

    [Code moderated as per the Forum Rules. Please use the pastebin]

  • The topic ‘Sort one catagory by ('meta_value_num') and ('order' => 'DESC') in’ is closed to new replies.