• 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

Post Expiration Plugin Genesis Loop

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 › Post Expiration Plugin Genesis Loop

This topic is: resolved

Tagged: ascending order, expiration dates, loop

  • This topic has 3 replies, 2 voices, and was last updated 8 years, 8 months ago by Brad Dalton.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • May 16, 2014 at 10:03 pm #105585
    jamesparkin
    Participant

    I have installed the Post Expiration Plugin for WordPress, and have posted several posts with future expiry dates. I want them to be listed in ascending order by expiry date. This is for an event & festival website.

    Plugin

  • http://wordpress.org/plugins/post-expirator/
  • I could use, but this just lists in reverse order that I posted them

    add_action('genesis_before_loop', 'child_before_loop');
    function child_before_loop () {
    global $query_string;
    query_posts($query_string . "&order=ASC");
    }

    Source:

  • http://surefirewebservices.com/wordpress/how-to-reverse-the-post-order-using-the-genesis-framework
  • -----------------------------------------------------------------

    A known way to solve my issue is to use, but I cant figure out where to place it in the functions.php, or inside a lop via Simple Hooks or the </head>

    <?php
    $args = array( 'post_type' => 'event', 'posts_per_page' => 15, 'order' => 'ASC', 'meta_key' => '_expiration-date', 'orderby' => 'meta_value' );
    $eventloop = new WP_Query( $args );
    if ( $eventloop->have_posts() ) : while ( $eventloop->have_posts() ) : $eventloop->the_post();

    //All the Loop Content Goes Here

    endwhile;
    endif;
    ?>

    Source:

  • http://www.wpbeginner.com/wp-tutorials/how-to-sort-posts-by-post-expiration-date-in-wordpress/
  • Thank You

May 16, 2014 at 10:14 pm #105588
Brad Dalton
Participant

Hard to test that code. Please paste all code in a Github Gist and link to it from here. Thanks.


Get Help – Book Consultation.

May 16, 2014 at 10:27 pm #105589
jamesparkin
Participant
  • https://gist.github.com/anonymous/242ec351bfa50ad511e2
  • By the way I am trying to get it to work with Lifestyle Pro.

    Thanks

    May 16, 2014 at 11:21 pm #105593
    Brad Dalton
    Participant

    Please mark this as resolved and create a new topic as the page is messed up caused by the code thanks.


    Get Help – Book Consultation.

  • Author
    Posts
  • Viewing 4 posts - 1 through 4 (of 4 total)
    • The topic ‘Post Expiration Plugin Genesis Loop’ 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

    © 2023 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