Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Elvin

    (@ejcabquina)

    Hi there,

    That particular topic was solved through shortcode because there’s no post__in on the orderby dropdown within the WPSP list edit page UI.

    Is there a way to do this for sorting by month and year…
    For example.
    I have post in category “Art”
    and I want to show/list art created in June 2020.

    To clarify: Do you mean to show posts filtered by a specific date range? say example: June 1, 2020 to June 30, 2020?

    Let us know.

    Thread Starter you4eea

    (@you4eea)

    Hey EJ,

    Yes sir, your example is correct.
    Being able to do that for any category would be great.

    Thanks

    Outside of that.. this is the perfect tool…
    I wish I would have found it years ago..

    • This reply was modified 2 years, 12 months ago by you4eea.
    Plugin Support Elvin

    (@ejcabquina)

    This isn’t something within the UI by default but we should still be able to do it with PHP snippet filters.

    Unfortunately, this feature is only doable with the alpha version at the moment. (be warned, alpha versions are not for live sites)

    First, you’ll need to install WPSP 1.2.0-alpha3 for the wpsp_query_args filter.
    https://wpshowposts.com/wp-show-posts-1-2-0/

    Here’s how:

    add_filter('wpsp_query_args',function( $args, $settings ){
    	if ( 1699 === (int) $settings['list_id'] ) {
    		$args['date_query'] = array(
                array(
                    'after'     => 'January 1st, 2015',
                    'before'    => 'December 31st, 2015',
                    'inclusive' => true,
                ),
            );
        }
    	return $args;
    },10,2);

    Where 1699 is the WPSP id you want to target.

    Alternative to this, you can try making modifications on the plugin as suggested by Tom here:
    https://wpshowposts.com/support/topic/including-more-than-one-post-type/#post-13241

    And use wp_show_posts_shortcode_args filter instead for date_query

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘sort by month and year?’ is closed to new replies.