Atte Moisio
Forum Replies Created
-
Forum: Plugins
In reply to: [AM Events] Conditionals in WidgetHi, I’ve just updated the plugin with the following shortcodes added:
[if cond="has-category"]hello[/if]
[if cond="has-venue"]world[/if]
Forum: Plugins
In reply to: [AM Events] Custom Field (URL) for EventYou are absolutely right, better remove those ifs!
The only way I know of for deleting the metadata is using delete_post_meta() in case of an empty field. I guess it’s up to you whether you want to do that or not!
Forum: Plugins
In reply to: [AM Events] Admin sorting by start date & separate listing of passed eventsI actually just realized that the fix above won’t really be useful without the separate page for passed events :). However, an actual calendar page like this would probably be even more useful.
Forum: Plugins
In reply to: [AM Events] Admin sorting by start date & separate listing of passed eventsHey,
Sure it’s possible. Adding the following to your functions.php should do the trick:
if(is_admin()) { add_action('pre_get_posts','am_set_default_admin_event_order'); } function am_set_default_admin_event_order( $query ) { if( is_post_type_archive('am_event') && !isset( $_GET[ 'orderby' ] ) ) { $query->set( 'post_type', 'am_event' ); $query->set( 'meta_key', 'am_startdate' ); $query->set( 'orderby', 'meta_value' ); $query->set( 'order', 'ASC' ); } }
Forum: Plugins
In reply to: [AM Events] Filter by recurringAll recurrent events contain the recurrence id as metadata, which can be retrieved with
get_post_meta($post_id, 'am_recurrence_id', true);
If this meta field is set, it means that the post is part of a recurring set.
You can take a look at the source code and search for “am_recurrence_id” to find examples of how it can be used with WP_Query.
Hope this helps!
Forum: Plugins
In reply to: [AM Events] Custom Field (URL) for EventThat would probably be a good idea, yes. For example, to prevent saving invalid urls you could replace the
trim
function withesc_url
.Forum: Plugins
In reply to: [AM Events] Custom Field (URL) for EventHello again, custom fields are now supported!
I’ve also added a
[meta key='my_meta_key']
shortcode for the widget to allow displaying custom fields.Example code for a custom url field:
<?php add_action('am_save_event', 'am_save_event_url'); function am_save_event_url($post_id) { $url = trim($_POST['am_event_url']); if (!empty($url)) update_post_meta($post_id, 'am_event_url', $url); } add_action('am_copy_event', 'am_copy_event_url', 10, 2); function am_copy_event_url($post_id, $recurrent_post_id) { $url = get_post_meta( $post_id, 'am_event_url', true); if (!empty($url)) update_post_meta($recurrent_post_id, 'am_event_url', $url); } add_action('add_meta_boxes', 'am_add_event_url_meta_box'); function am_add_event_url_meta_box() { add_meta_box('am_event_url_metabox', 'Event Url', 'am_event_url_meta_box_content', 'am_event', 'normal', 'high', null); } function am_event_url_meta_box_content($post) { if (function_exists('am_nonce')) wp_nonce_field(plugin_basename(__FILE__), 'am_nonce'); $metaUrl = get_post_meta($post->ID, 'am_event_url', true); ?> <input type="text" id="am_event_url" name="am_event_url" value="<?php echo esc_attr($metaUrl) ?>" /> <?php } ?>
Forum: Plugins
In reply to: [AM Events] Custom Field (URL) for Event“Finally a events plugin that’s not doing way too much and adhering to WordPress standards.”
Glad to hear that! It’s pretty much what I’ve been trying to accomplish all along ??
Anyway, I think these plugins you mentioned would have a hard time handling recurring events. If you’re not using them, then I see no problem. What I could do though, is add some custom hooks to allow managing extra fields in your functions.php for example. I’ll see what I can do.
Forum: Plugins
In reply to: [AM Events] This plugin can count number of date is selectedHi,
Your question is a bit hard to follow but apparently you just want to calculate the duration of an event? If that’s the case, you should look at PHP’s DateTime.
Examples here: https://stackoverflow.com/questions/676824/how-to-calculate-the-difference-between-two-dates-using-php
Forum: Plugins
In reply to: [AM Events] Activating Plugin removes Tags support from standard postsOk, should now be fixed, try updating the plugin.
I haven’t really used tags anywhere so I can’t really confirm if they are working perfectly, so please inform me if you still have any issues ??
Forum: Plugins
In reply to: [AM Events] Activating Plugin removes Tags support from standard postsHi,
You’re right. I’ll try to fix this right away.
Forum: Plugins
In reply to: [AM Events] Table template to put in as code on a page?Hey,
You can take a look at my child theme example at GitHub: https://github.com/attemoi/am-events-child-theme/blob/master/twentytwelve-child/page-event-table.php
Forum: Plugins
In reply to: [AM Events] I can't changing slug error 404Good to know you found a solution ??
Just to let you know the plugin comes with ready made template tags for exactly that purpose. For a full list see Template tags under Other Notes.
Here are the ones for getting event dates:
am_get_the_startdate( $format = 'Y-m-d H:i:s', $post = 0 ) am_get_the_enddate( $format = 'Y-m-d H:i:s', $post = 0 )
Forum: Plugins
In reply to: [AM Events] I can't changing slug error 404Hi,
Do you mean the general slug for event posts? Have you tried reapplying your permalinks after changing the slug? Just go to Settings -> Permalinks and press Save Changes.
Forum: Plugins
In reply to: [AM Events] tags being stripped from recurring eventsHi,
This is now fixed, sorry it took so long!