Fundraising Plugin: Query Posts to Include only current and future fundraisers

Is there a post query to use to display only current and future fundraisers, and not include the completed or closed fundraisers?

I can't believe this plugin doesn't have featured fundraisers as an option...

  • Rupok

    Hi Marcus, hope you are having a wonderful day.

    Is there a post query to use to display only current and future fundraisers, and not include the completed or closed fundraisers?

    Like your previous thread, our plugin developer can give you best idea regarding this. So I'm pinging him again regarding this.

    Please keep in mind again, our developers work round the clock and they have to deal with lots of critical issues and other things. So it may take a little while for them to check this and provide a feedback.

    I can't believe this plugin doesn't have featured fundraisers as an option

    I really like this idea. So I'm moving your thread to our Features and Feedback section. More people liking the idea, more chances our developers will work on this and will include this feature in our future releases.

    Have a nice day. Cheers!
    Rupok

  • Maniu

    Hello Marcus

    You could use "wdf_goal_end" meta data to show current and future fundraisers. It is stored in "YYYY-MM-DD" format.

    This should give you more info on how to use it:
    https://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters
    https://developer.wordpress.org/reference/functions/query_posts/ should work with "meta_query"

    Unfortunately not including completed fundraisers would not be so easy.

    Thanks,
    Maniu

  • Marcus
    <?php
    	$paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1;
    	$args = array(
    		'posts_per_page' => 1,
    		'paged' => $paged,
    		'post_type' => 'funder',
    		'orderby' => 'meta_value',
    		'order'=>'ASC',
    		'meta_key' => 'wdf_goal_end',
    		'meta_query' => array(array(
    				'relation'=> 'AND',
    				array(
    					 'key'     => 'wdf_goal_end',
    					 'value'   => date('Y-m-d',strtotime("today")+(360*60*60*24)),
    					 'compare' => '<=',
    					 'type'    => 'DATE'
    				),
    				array(
    					 'key'     => 'wdf_goal_end',
    					 'value'   => date('Y-m-d',strtotime("today")),
    					 'compare' => '>=',
    					 'type'    => 'DATE'
    				)
    		))
    	);
    	global $wp_query;
    	query_posts(
    		array_merge(
    			$wp_query->query,
    			$args
    		));
    ?>
    <?php if(have_posts()) : ?>
    	<ul>
    		<?php while(have_posts()) : the_post(); ?>
    			<li>
    				<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    					<header class="entry-header">
    						<a href="<?php the_permalink(); ?>"><h1 class="entry-title"><?php the_title(); ?></h1></a>
    					</header>
    					<div class="entry-content">
    						<?php the_content(); ?>
    					</div><!-- .entry-content -->
    					<footer class="entry-meta">
    						<?php edit_post_link( __( 'Edit', 'customtheme' ), '<span class="edit-link">', '</span>' ); ?>
    					</footer><!-- .entry-meta -->
    				</article><!-- #post -->
    			</li>
    		<?php endwhile; ?>
    	</ul>
    <?php endif; ?>
    	<?php echo paginate_links(); ?>

    This is what I am using in my archive-funder.php to display only current and future fundraisers and not completed fundraisers. Since we are doing a monthly fundraiser, we don't want to list completed fundraisers at the beginning of our archive file and force a user to scroll past all the completed fundraisers before arriving at the current months. This way, we can list the current monthly fundraiser, and paginate to future fundraisers that will be labeled "Next Month" and "Previous Month".

    Is there a meta key I could use to query posts who have a time_left of "Time's Up!" and display our completed fundraisers? Not sure what value to use to check against.

  • Kasia Swiderska

    Hello Marcus,

    Is there a meta key I could use to query posts who have a time_left of "Time's Up!" and display our completed fundraisers? Not sure what value to use to check against.

    There are two meta keys wdf_goal_end and wdf_goal_start - Time's up is counted basing on those dates - so it checks todays date and counts how many days left - and if "$now > $end_date" (today is bigger than end date) then fundraising is over. You can see that in file /wp-content/plugins/fundraising/lib/template-functions.php in function wdf_time_left().

    Let me know if this helps.

    kind regards,
    Kasia

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.