• 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

Retrieve a set of posts in a specified date range

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 › Retrieve a set of posts in a specified date range

This topic is: not resolved
  • This topic has 1 reply, 1 voice, and was last updated 13 years, 6 months ago by stacyvlasits.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • March 11, 2013 at 4:05 pm #25515
    stacyvlasits
    Member

    I have a category called "News."  On my "News" category page I would like to only show posts that have been made in the last 30 days.

    Here is the code I started out with:

    <code>

    remove_action('genesis_loop', 'genesis_do_loop');
    add_action('genesis_loop', 'pm_recent_news_loop');

    function pm_last_name_loop() {
    global $query_args;
    $args = (array(
    //????
    ));

    genesis_custom_loop( wp_parse_args($query_args, $args) );

    }
    genesis();

    </code>

    In the general WordPress API documentation it basically says that you can't achieve filtering by date range by passing in arguments to the $query_args (which is the way that genesis_custom_loop accomplishes it. Instead, it seems that the correct way to do this is to add_filter ('posts_where', 'my_where_filter') and then define the where clause by post_date.  Ref:  http://codex.wordpress.org/Class_Reference/WP_Query#Parameters.

    However I can't get this to work. When I attempt to implement code similar to that described in the codex I either get none of my posts or I get all of my posts.  I assume that this is because Genesis somehow works around the posts_where filter or wraps it in such a way that it doesn't get called.

    Thoughts?

    March 13, 2013 at 12:08 pm #25895
    stacyvlasits
    Member

    Is it bad form to /bump a post in this forum? I'm worried I may have posted this too late in the day for it to be seen.

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

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

Create a site with WP EngineShop for Themes

Footer

StudioPress

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