Get Posts ordered by a date custom meta field
Try to change ‘orderby’ => ‘meta_value’,’meta_key’ => ‘event-date-start’
Try to change ‘orderby’ => ‘meta_value’,’meta_key’ => ‘event-date-start’
There is a way to do it. Just include that CSS inside header before wp_head() with internal css. And then add the Source using PHP like below <style> .about-img:after { background-image: url(<?php bloginfo(‘template_directory’)?>/img/tola.jpeg); } </style>
If you want to get the post for an actor for example, there is different solutions, but in my opinion, the best is to use tag as actors names, or post meta. The current solution I give to you is using WordPress search system and try to find posts. // We try to get post … Read more
This question probably belongs to Code Review. Anyway, you can fill your event properties inside an array, which you can iterate: $events = array( ‘opening’ => array( ‘time’ => ‘…time here…’, ‘formatted_time’ => ‘…time here…’, ‘label’ => __(‘Opening:’), // or ucfirst($type) if you want… ), ‘closing’ => array( ‘time’ => ‘…time here…’, ‘formatted_time’ => ‘…time … Read more
This doesn’t look like it would produce meaningful SQL, keys cannot hold different values at the same time (that’s why JOINs are usually required in complex queries). Also using $_GET global in queries is horribly insecure, if you have this anywhere near live site you should remove it immediately. You earlier question used WP_Query, if … Read more
As already said, your query arguments are slightly off – meta_query should be an array of arrays: $query = new WP_Query( array( ‘category_name’ => ‘events’, ‘order’ => ‘DESC’, ‘orderby’ => ‘meta_value’, ‘meta_query’ => array( array( ‘key’ => ‘start_date’, ‘value’ => strtotime( ‘today’ ), ‘compare’ => ‘>=’, ‘type’ => ‘UNSIGNED’, // Ensure MySQL treats the value … Read more
Metas do not exist on wordpres without handles. Therefore, if you remove all handles from a meta of a given name in your Meta Data Handling section (not accessible from menu without a plugin, rather by adding a new meta key), the key will be automatically deleted.
The following example is adding a meta box to the post edit screen and the wporg_cpt edit screen. function wporg_add_custom_box() { $screens = [‘post’, ‘wporg_cpt’]; foreach ($screens as $screen) { add_meta_box( ‘wporg_box_id’, // Unique ID ‘Custom Meta Box Title’, // Box title ‘wporg_custom_box_html’, // Content callback, must be of type callable $screen // Post type … Read more
This query will get all the countries and counts in one query: global $wpdb; $countries_count = $wpdb->get_results( ” SELECT meta_value AS country, COUNT(post_id) AS count FROM {$wpdb->postmeta} WHERE meta_key = ‘tgt_job_country’ GROUP BY country ORDER BY country” ); foreach ($countries_count as $country) echo “<li><a href=”http://dsdjjhfgd.net/s=jobseeker&usertype=jobseeker&country=”.$country->country.”&search=Search”>”.$country->country.”(“.$country->count.”)</a></li>”; Unless you need to get the country list first – … Read more
It is not working because there is a custom query in the events plugin that adds the posts to be ignored (not returned) when you run WP_Query. See getHideFromUpcomingEvents() method in the-events-calendar/src/Tribe/Query.php. But there is however a filter hook that you can use there to do whatever. See the following sample code: function wpse283031_hide_ids( $ids … Read more