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

Include custom table in query

Working code: <?php global $wpdb; $date = date(“Y-m-d”); $querystr = ” SELECT * FROM wp_posts JOIN wp_ftcalendar_events ON wp_posts.ID = wp_ftcalendar_events.post_parent WHERE wp_posts.post_status=”publish” AND wp_posts.post_type=”post” AND wp_ftcalendar_events.start_datetime >= ‘$date’ ORDER BY wp_ftcalendar_events.start_datetime ASC “; $pageposts = $wpdb->get_results($querystr, OBJECT_K); ?> <?php if ($pageposts): ?> <?php global $post; ?> <?php foreach ($pageposts as $post): ?> <?php setup_postdata($post); … Read more

DOM reference to TinyMCE editor element (button)

Try adding an id attribute in your button definition: ed.addButton(‘solution’, { disabled: 0,//count_problems(ed).length == 0, id: ‘my_button’, title : ‘Add problem solution’, //cmd: ‘solution_fun’, image : url + ‘/images/wspringer.png’, type: ‘menubutton’, menu: [{text: ‘problem id = ‘ + 1, value: 1}], onselect: function(v1) { ed.windowManager.open({ title: ‘Insert solution in popeye output format’, body: [{type: ‘textbox’, … Read more

How to display the past events in one of the category?

you would need to use the date query: $args = array ( ‘cat’ => ‘1234’, // if category being used ‘post_type’ => ‘events’, // if custom post type ‘paged’ => get_query_var(‘paged’), ‘order’ => ‘DESC’, ‘paged’ => $paged, ‘date_query’ => array( // this is the thing you need array( ‘before’ => array( // this is ‘before … Read more

Query events post type after current date and timezone

date() PHP functions returns the value of time() PHP functions in the specified format. time() use server local time. If you want to get date/time based of WordPress configuration, you could use current_time(), a WordPress function, instead of native PHP functions. // ‘timestamp’ = Unix Timestamp or ‘U’ PHP time format $current_time = current_time( ‘timestamp’ … Read more