WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Sort one catagory by ('meta_value_num') and ('order' => 'DESC') in (1 post)

  1. w12gilbert
    Member
    Posted 2 years ago #

    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
    (multiagent.php)
    Theme Functions
    (functions.php)
    home.php
    (home.php)
    slider.php
    (slider.php)

    Genesis parent theme has the following templates
    404 Template
    (404.php)
    Archive Page Template
    (page_archive.php)
    Blog Page Template
    (page_blog.php)
    Comments
    (comments.php)
    Footer
    (footer.php)
    Header
    (header.php)
    Main Index Template
    (index.php)
    Page Template
    (page.php)
    Sidebar
    (sidebar.php)
    Single Post
    (single.php)
    Theme Functions
    (functions.php)
    init.php
    (init.php)
    sidebar-alt.php
    (sidebar-alt.php)

    Based on the wordpress template hierarchy found at http://codex.wordpress.org/Template_Hierarchy 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 http://www.billgilberthomes.com

    the folloing is the templates

    Main Index Template(parent theme- Genesis)

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

Topic Closed

This topic has been closed to new replies.

About this Topic