Forum Replies Created

Viewing 11 replies - 76 through 86 (of 86 total)
  • Plugin Author Atte Moisio

    (@moisture)

    Hey,

    You’re right, the plugin didn’t actually copy featured images (or excerpts) when creating recurrent events.

    I just released version 1.6.0, which should fix this. Also tested with the duplicate post plugin and works okay. Thanks for reporting the problem!

    Plugin Author Atte Moisio

    (@moisture)

    Why exactly do you want to change the format and to what format? Do you need to change the format in which the dates are stored in the database? The current default format is yyyy-mm-dd hh:mm:ss. I could make it easy for you to change the database format if that’s what you need.

    Could you maybe use the current format and just change it after you have pulled the event posts? I may be a little off the track here, as I am not very familiar with JSON myself.

    Plugin Author Atte Moisio

    (@moisture)

    It should show all events which haven’t ended yet.

    You can fiddle with the time() function to change how long ago the events are shown. You could for example replace time() with time() – (24 * 60 * 60) to show events with an end time greater than 24h before the current time.

    Plugin Author Atte Moisio

    (@moisture)

    Hmm, it should be working, as I copied it straight from the page-event-blog example, which I have tested.

    Could you provide any additional information on how it doesn’t work? What version of wordpress and php are you using?

    Plugin Author Atte Moisio

    (@moisture)

    Just replace

    $args = array(
            'post_type' => 'am_event',
            'post_status' => 'publish',
        	);

    with

    $args = array(
    	'post_type' => 'am_event',
    	'post_status' => 'publish',
    	'orderby' => 'meta_value',
    	'meta_key' => 'am_startdate',
    	'order' => 'ASC',
    	'meta_query' => array(
    		array(
    			'key' => 'am_enddate',
    			'value' => date('Y-m-d H:i:s', time()),
    			'compare' => ">",
    		),
    	),
    );

    This will show only ongoing and upcoming events ordered by date from newest to latest

    Plugin Author Atte Moisio

    (@moisture)

    The code in my previous post should work just fine and seems like you are putting it in the right place.

    Are you sure the custom page template is actually being used? Also make sure the plugin is enabled and that you have created one or more events that can be shown. Does the page show any errors or does it just create a page with no events?

    Plugin Author Atte Moisio

    (@moisture)

    Generally you would want to replace the page’s content with the content generated by the wp_query or simply add the query after the content.

    In your example, you could add the wp_query right after <?php the_content() ?>. If you need to enable comments for the events, you should also move all the comments stuff inside the query.

    Keep in mind that the page-event-blog example contains a lot of features that you may not need, like thumbnail, comments or featured posts. The bare minimum you need to loop through and display all posts is this:

    <?php $args = array(
            'post_type' => 'am_event',
        );
    
    $the_query = new WP_Query($args); ?>
    
    if ($the_query->have_posts()) {
    	while ($the_query->have_posts()) {
    		$the_query->the_post();
    
    		the_title();
                    the_content();
    	}
    }
    Plugin Author Atte Moisio

    (@moisture)

    That’s a good idea. I see no reason why I shouldn’t add it, as it can be hidden by the user.

    I just updated the plugin and version 1.5.0 now supports both thumbnails and excerpts for event posts.

    Thanks for asking!

    Plugin Author Atte Moisio

    (@moisture)

    I should also add that what you probably need is a child theme with a custom page template. That would allow you to update your theme without losing any modifications.

    I’ve created a simple working child theme for Twenty Twelve, with three custom page templates that can be assigned to any page. You could modify them to suit your own theme. Download here.

    Plugin Author Atte Moisio

    (@moisture)

    Notice also that I added template tags in version 1.3.0, which makes it easier to get and display event data (dates, venues and categories).

    Plugin Author Atte Moisio

    (@moisture)

    The code you posted seems ok, but it only creates the query. To display the event posts, you need to use $the_query to loop through and display all of them.

    So you need to add something like this below:

    if ($the_query->have_posts()) {
    	while ($the_query->have_posts()) {
    		$the_query->the_post();
    
    		$postId = $post->ID;
    
    		// GET EVENT DATA 
    
    		$startDate = am_get_the_startdate('Y-m-d H:i:s');
    		$endDate = am_get_the_enddate('Y-m-d H:i:s');
    		$venues = am_get_the_venue( $postId );
    		$eventCategories = am_get_the_category( $postId );
    
    		// DISPLAY EVENT CONTENT
    
    		the_title();
    
    		echo '<p>' . $startDate . '</p>';
    		echo '<p>' . $endDate . '</p>';
    
    		// echo the first venue
    		echo '<p>' . $venues[0]->cat_name . '</p>';
    
    		// echo list of all event categories with template tag
    		am_the_event_category();
    
    		the_content();
    
    	}
    }

    You also need to make sure you put the code in the right template file, like a custom page template.

    Hope this helps. I’ll probably write more examples or an easier tutorial later this week.

Viewing 11 replies - 76 through 86 (of 86 total)