• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Reverse CTP order

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Reverse CTP order

This topic is: resolved

Tagged: Custom Post Type

  • This topic has 6 replies, 4 voices, and was last updated 9 years, 10 months ago by sbn128.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • July 26, 2015 at 3:08 pm #160518
    sbn128
    Member

    Hello! How to change below code for cusom post type "Portfolio" archive page 'Topic' (taxonomy). Any help.

    /* Reverse Post Order for Post Archives on the Genesis Framework

    add_action( 'pre_get_posts', 'prefix_reverse_post_order' );

    function prefix_reverse_post_order( $query ) {
    if ( is_admin() )
    return;

    // Only change the query for post archives.
    if ( $query->is_main_query() && is_archive() && ! is_post_type_archive() ) {
    $query->set( 'orderby', 'date' );
    $query->set( 'order', 'ASC' );
    }
    }

    July 27, 2015 at 12:46 am #160549
    robimex
    Member

    I`ve the same question...
    I am waiting for an answer

    July 27, 2015 at 1:15 am #160551
    Brad Dalton
    Participant

    Try

    is_tax

    https://codex.wordpress.org/Function_Reference/is_tax


    Tutorials for StudioPress Themes.

    July 27, 2015 at 4:47 am #160559
    cassidy
    Member

    Thanks braddalton!

    July 27, 2015 at 6:06 am #160565
    sbn128
    Member

    is tax not work. Please help.

    /* Reverse Post Order for Post Archives on the Genesis Framework

    add_action( 'pre_get_posts', 'prefix_reverse_post_order' );

    function prefix_reverse_post_order( $query ) {
    if ( is_admin() )
    return;

    // Only change the query for post archives.
    if ( $query->is_main_query() && is_tax('portfolio') && ! is_post_type_archive() ) {
    $query->set( ‘orderby’, ‘date’ );
    $query->set( ‘order’, ‘ASC’ );
    }
    }

    July 27, 2015 at 6:42 am #160568
    Brad Dalton
    Participant

    @sbn128 Please embed your code correctly using the correct method

    If anyone copies your code it will break their site as you have embedded it incorrectly.

    portfolio is a post type and not a taxonomy. The code is tested and works.

    Read here please


    Tutorials for StudioPress Themes.

    July 30, 2015 at 11:24 am #160957
    sbn128
    Member

    Thank you, Brad. I Understood.

  • Author
    Posts
Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Reverse CTP order’ is closed to new replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble