• Resolved lxm7

    (@lxm7)


    Sorry for the noob question but how would i write this in the PHP file with the following short code?

    {has_category_X}content{/has_category_X}

    to display events that correlate to a certain category?

    I’ve tried the code below (where cat1 is the name of the category) but doesnt seem to display anything.

    echo do_shortcode('[has_category_cat1}content{/has_category_cat1]')

    RE-EDIT: I’ve also tried passing arguments to the WP_query object and this lists all events, and doesnt filter category:

    $args = array( 'post_type' => 'event', 'category' => 'cat1' );
     		$loop = new WP_Query( $args );
     		while ( $loop->have_posts() ) : $loop->the_post();
Viewing 1 replies (of 1 total)
  • Thread Starter lxm7

    (@lxm7)

    I found this was the syntax that did it, mainly on the 2nd line that I was lost on what it should be ( ‘format’=>'{has_category_cat1}: )

    $args = array( 'post_type' => 'event' );
    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post();
     	echo EM_Events::output( array( 'limit'=>3,'format'=>'{has_category_cat1}
     	<ul>
     	  <li>
     	    <h2>#_EVENTNAME</h2>
    	 	<p>#_EVENTEXCERPT</p>
     		#_24HSTARTTIME
    		#_24HENDTIME
    		#_12HSTARTTIME
    		#_12HENDTIME
    		#_EVENTTIMES
    		#_EVENTDATES
     	   </li>
     	</ul>
     {/has_category_cat1}') );
    endwhile;

    I guess this (! the format argument !) must be somewhere in the documentation but its pretty hard to find, even the #_(placeholders) seemed quite hidden, possibly the navigation isn’t quite as clear as it could be for the plugin site. Phenomenal plugin though!

Viewing 1 replies (of 1 total)
  • The topic ‘Displaying Events by category – Events Manager’ is closed to new replies.