WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] Recurring Event - Display custom info from each date (7 posts)

  1. ryanoutloud
    Member
    Posted 1 year ago #

    I have recurring events that are book clubs, but each meeting each book club has a different book they read. I have setup custom fields for the book title, author, and link.

    Here is what I currently have: http://munson.liquidweb.com/~bvpb/book-clubs/

    As you can see I only want to display each Book Club once, then show the book info for the next meeting of that club. What's the best way to go about this?

    Here is what I am currently using.

    $args = array(
    'scope'=>$beginDate.','.$endDate,
    'limit'=>10,
    'pagination'=>1,
    'category'=>12,
    'recurring'=>1,
    'format' => '
    		<article class="club">
    			#_EVENTIMAGE{329,246}
    			<div class="title">
    				<div class="text-left">
    					<br/>
    					<strong class="title"><a href="#_EVENTURL">#_NAME</a></strong><br/>
    					<time datetime="#_{m-j-y}" class="time">#_ATT{sub_title}</time>
    				</div>
    			</div>
    			<div class="detail">
    				 <div class="row">
    					<div class="btns-holder">
    						<a href="#_EVENTICALURL">add to calendar</a>
    					</div>
    					<ul class="social-networks">
    						<li><a href="http://www.facebook.com/sharer.php?u=#_EVENTURL&t=BVPL.org #_NAME" target="_blank">facebook</a></li>
    						<li class="twitter"><a href="http://twitter.com/share?text=BVPL.org #_NAME&url=#_EVENTURL" target="_blank">twitter</a></li>
    					</ul>
    				</div>
    				<div class="text-left">
    					<span class="subtitle"></span>
    					<strong class="title"><a href="#_EVENTURL">#_NAME</a></strong><br/>
    					<time datetime="#_{m-j-y}" class="time">#_ATT{sub_title}</time>
    				</div>
    				<div class="text-holder">
    					<div class="text-right">
    						<p>#_EVENTEXCERPT</p>
    					</div>
    					<div class="text-right">
    						<p><strong>Next Meeting:</strong> #_{M d}</p>
    						<p><strong>Book:</strong> <a href="#_ATT{selected_book_link}">#_ATT{selected_book}</a></p>
    						<p><strong>Author:</strong> #_ATT{author}</p>
    					</div>
    				</div>
    				<a href="#_EVENTURL" class="moreinfo">More Info ></a>
    			</div>
    		</article>
    '
    );
    
    echo em_events($args);

    http://wordpress.org/plugins/events-manager/

  2. angelo
    NetWebLogic Support
    Posted 1 year ago #

    have you tried recurrence=X where X is the event id of the recurring event ?

    http://wp-events-plugin.com/documentation/event-search-attributes/

  3. ryanoutloud
    Member
    Posted 1 year ago #

    I have not, I was trying to avoid any unnecessary loops, but I think I can make that work if that's the simplest way.

    Is there a quick call to get an array of all the recurring event IDs?

  4. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    EM_Events::get(array('recurring'=>1, 'array'=>1));

  5. ryanoutloud
    Member
    Posted 1 year ago #

    Thanks for the quick reply Marcus. That will work if I can get back the event id instead of the post id.

  6. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    $EM_Event = em_get_event($post);
    $EM_Event->event_id;

    or

    $EM_Event = em_get_event($post->ID, 'post_id');
    $EM_Event->event_id;

    :)

  7. ryanoutloud
    Member
    Posted 1 year ago #

    Got it, thanks fellas.

    $eventPosts = EM_Events::get(array('recurring'=>1, 'array'=>1));
    
    			foreach ($eventPosts as $post){
    				$EM_Event = em_get_event($post['post_id'], 'post_id');
    				$eventID = $EM_Event->event_id;
    
    				$args = array(
    					'scope'=>$beginDate.','.$endDate,
    					'limit'=>1,
    					'category'=>12,
    					'recurrence'=>$eventID,
    					'format' => '
    							<article class="club">
    								#_EVENTIMAGE{329,246}
    								<div class="title">
    									<div class="text-left">
    										<br/>
    										<strong class="title"><a href="#_EVENTURL">#_NAME</a></strong><br/>
    										<time datetime="#_{m-j-y}" class="time">#_ATT{sub_title}</time>
    									</div>
    								</div>
    								<div class="detail">
    									 <div class="row">
    										<div class="btns-holder">
    											<a href="#_EVENTICALURL">add to calendar</a>
    										</div>
    										<ul class="social-networks">
    											<li><a href="http://www.facebook.com/sharer.php?u=#_EVENTURL&t=BVPL.org #_NAME" target="_blank">facebook</a></li>
    											<li class="twitter"><a href="http://twitter.com/share?text=BVPL.org #_NAME&url=#_EVENTURL" target="_blank">twitter</a></li>
    										</ul>
    									</div>
    									<div class="text-left">
    										<span class="subtitle"></span>
    										<strong class="title"><a href="#_EVENTURL">#_NAME</a></strong><br/>
    										<time datetime="#_{m-j-y}" class="time">#_ATT{sub_title}</time>
    									</div>
    									<div class="text-holder">
    										<div class="text-right">
    											<p>#_EVENTEXCERPT</p>
    										</div>
    										<div class="text-right">
    											<p><strong>Next Meeting:</strong> #_{M d}</p>
    											<p><strong>Book:</strong> <a href="#_ATT{selected_book_link}">#_ATT{selected_book}</a></p>
    											<p><strong>Author:</strong> #_ATT{author}</p>
    										</div>
    									</div>
    									<a href="#_EVENTURL" class="moreinfo">More Info ></a>
    								</div>
    							</article>
    					'
    					);
    
    					if (EM_Events::count( $args ) > 0 ) {
    						echo em_events($args);
    					}
    			}

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic