Post Terms As Class Name For Full Calendar Events

You are using get_single_term in a way that would require it to return a value… $term = get_single_term($post->ID, ‘course_locations’); … but you have written it in such a way that it echos a value. You should have… function get_single_term($post_id, $taxonomy) { $terms = wp_get_object_terms($post_id, $taxonomy); if(!is_wp_error($terms)) { return $terms[0]->name; } } I noticed a couple … Read more

Identifying a Page Containing Shortcode at `init`

I’ve found an answer, although messy. /* // Plugin information goes here */ $GLOBALS[‘example_class’] = new example_class; class example_class { var $public_loaded = false, $content=””; public function admin_init() { add_menu_page( // … ); } // End of admin_init function public function get_random( ) { // … } } // End of example class add_action(‘init’, function() … Read more

Query Event Posts by Date

You need type casting for custom fields event-start-date and event-end-date. Then it will compare with time() & date() value. You need to add ‘type’ => ‘DATE’, in your meta query args. So your meta query will be like this: switch ($print_type) { case ‘current’: $meta_quer_args = array( ‘relation’ => ‘AND’, array( ‘key’ => ‘event-start-date’, ‘value’ … Read more

Loop posts in a table ordered by a custom field value

I found a solution which displays the posts ordered by the date value, and also removes the past ones. <div class=”container”> <div class=”row”> <table> <tr> <th>Artista</th> <th>Fecha</th> <th>Ciudad</th> <th>Información</th> </tr> <?php $today = current_time(‘Ymd’); $args = array( ‘post_type’ => ‘evento’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => ‘-1’, ‘meta_query’ => array( array( ‘key’ => ‘fecha_del_evento’, ‘compare’ => … Read more