• Resolved ikki83

    (@ikki83)


    Hi folks,
    i use you events manager plugin and i fall in love with it. πŸ™‚
    I’ve got a problem: when i create a recurring event, it creates a post for every single day and it publishes them in homepage.
    It’s possible to show only one post for the recurring events in home?

    I use this code to display events in homepage, insterted in functions.php:

    <?php
    	$loop = new WP_Query( array(
    	'post_type' => 'event',
            'posts_per_page' => 5,
    )); ?>
    
    <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
    
    <?php // added this to be able to use shortcodes and placeholders
    	$EM_Event = em_get_event($post->ID, 'post_id'); ?>
    
    	<h4><?php echo $EM_Event->output('#_EVENTLINK'); ?></h4>
    
    <?php endwhile; /* End loop */ ?>
    <?php wp_reset_query(); ?>

    My site is http://www.giuriservice.com

    Thanks in advance for your support.

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

Viewing 14 replies - 1 through 14 (of 14 total)
  • you can add attributes like recurring=1

    e.g. em_get_events( array(‘post_id’=>$post->ID,’recurring’=>1) )

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

    Thread Starter ikki83

    (@ikki83)

    how can i modify my code with yours?

    Thread Starter ikki83

    (@ikki83)

    solved, i’m very tired today!

    Thread Starter ikki83

    (@ikki83)

    ok, i wake up this morning and the problem is repeated automatically: i’ve found again the duplicated post in home page.
    To resume i’ve used this code in index.php for the wordpress loop:

    <?php get_header(); ?>
    <div class="content-wrapper">
    	<div class='gdl-page-item'>
    		<div class='sixteen columns'>
    
    			<?php
    				$loop = new WP_Query( array(
    				'post_type' => 'event',
    			        'posts_per_page' => 5,
    			)); ?>
    
    			<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
    
    			<?php // added this to be able to use shortcodes and placeholders
    				$EM_Event = em_get_events( array('post_id'=>$post->ID,'recurring'=>1) ); ?>
    
    				<h4><?php echo $EM_Event->output('#_EVENTLINK'); ?></h4>
    
    			<?php endwhile; /* End loop */ ?>
    			<?php wp_reset_query(); ?>
    
    		</div>
    	</div>
    	<div class="clear"></div>
    </div>
    <?php get_footer(); ?>

    and this in funciotns.php:

    add_filter( 'pre_get_posts', 'my_get_posts' );
    function my_get_posts( $query ) {
    	if ( is_home() && false == $query->query_vars['suppress_filters'] )
    		$query->set( 'post_type', array( 'post', 'event' ) );
    	return $query;
    }

    I hope you can help me.

    [No bumping, thank you.]

    Hi,
    i’ve got the same problem. I’ve searched around the web but i can’t find a solution.
    Please help.

    Thank you.

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    do these recurring events repeat in the admin area? If not then I’d check the code you’re using as above, because it’s probably in there somewhere where the problem lies.

    for showing events on a homepage – http://justintadlock.com/archives/2010/02/02/showing-custom-post-types-on-your-home-blog-page

    ourpost type is event or the EM_POST_TYPE_EVENT constant

    Thread Starter ikki83

    (@ikki83)

    the events repeat in admin area in “Events” section.

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    could it be you duplicated them somehow?

    try deleting one and see, as if one event gets trashed and disappears from the search, it must have been duplicated somehow (e.g. recurring events?).

    Thread Starter ikki83

    (@ikki83)

    it repeats because i create recurring events, but i just want that n homepage it will be displayed only one post to promote the event.
    If i delete the single events that the recurring option creates, i get my target but they will disappear from the events calendar, too,
    Please help me…

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    i see, so they’re not duplicates but recurrences which you want to hide.

    unfortunately this isn’t possible without you creating custom php code for it, you’d need to loop through events check if they’re a repeated recurrence and then show only if not shown before in the list.

    here’s something (untested, hand-written) to get you started-

    $shown_recurring_id = array()
    foreach ( EM_Events::get(array('recurrence'=>1) as $EM_Event ){
      if( !in_array($EM_Event->recurring_id, $shown_recurring_id) ){
        //show event
      }else{
        //already shown
        $shown_recurring_id[] = $EM_Event->recurring_id;
      }
    }
    Thread Starter ikki83

    (@ikki83)

    i’ve tried a lot of different kind of solutions based on this code, but no one seems to work.
    Can you help me?

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    you’d need to hire a developer to help you further, e.g. try – http://jobs.wordpress.net

    Thread Starter ikki83

    (@ikki83)

    ok thanks…
    another question:can you help me if i want to group recurring events in the Events Widget?
    I’m planning to buy the pro version, i need paypal support πŸ™‚

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    if it’s the same principle as above, then you’d still need to hire a dev for that as it’s the same thing.

    if you mean something else, maybe. one way to go for starters for grouping events together is the use of categories.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘[Plugin: Events Manager] Recurring events create too many post in homepage’ is closed to new replies.