WordPress.org

Ready to get started?Download WordPress

Forums

Nano Plugin Manager
Don't Sort All Categories (3 posts)

  1. jhdemicco
    Member
    Posted 1 year ago #

    Love the plug-in. Wondering if you can guide me on the coding needed to sort only posts in certain categories.

    Thanks!

    Jim

    http://wordpress.org/extend/plugins/nano-plugin-manager/

  2. jhdemicco
    Member
    Posted 1 year ago #

    Checking in to see if anyone has a solution for this.

    Thanks,

    Jim

  3. kidalpha
    Member
    Posted 1 year ago #

    @jhdemicco, I just did this and am happy to share. Copy the following XML into a file with an XML extension and import it into the plugin manager: (1) modify the 'Release News' to whatever category name you want to sort and (2) change the 'post_modified' to the wp_post table column name you want to sort by and (3) change DESC to ASC if you want to go ascending:

    <data>
    <name>Sort Posts by Last Modified</name>
    <description>Sorts all your posts by Last Modified.</description>
    <type>filter</type>
    <tag>posts_orderby</tag>
    <arguments>$orderby</arguments>
    <content>
    if(!is_admin() && is_category('Release News') ){ return 'post_modified DESC'; } else{ return $orderby; }
    </content>
    <priority/>
    </data>

    Cheers!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic