How to format the various types of custom fields?
How to format the various types of custom fields?
How to format the various types of custom fields?
Why not pull the post you need, rather than pull a post and then check the value of the meta key? $now = strtotime(date(‘d-m-Y H:i:s’)); // get current timestamp $args = array( ‘post_type’ => ‘presenter’, ‘posts_per_page’ => ‘1’, ‘order’ => ‘DESC’, ‘meta_query’ => array( array( ‘key’ => ‘on_air’, ‘value’ => $now, ‘compare’ => ‘>=’, ), … Read more
“You have to explicitly pass post ID as the 2nd argument.” – Milo In the Advanced Custom Fields plugin file, plugins/advanced-custom-fields/core/api.php, get_fields has a default $post_id of false, and calls on get_field_objects, which seems to run specific calls to $wpdb->get_col($wpdb->prepare, depending on what $post_id contains (is_numeric?, strpos(‘user_’)), so I guess depending on the environment of … Read more
ok got it myself didnt thought it would be that simple require_once($_SERVER[‘DOCUMENT_ROOT’] . ‘/wp-load.php’); $postid = $_GET[“postid”]; $custom = get_post_custom($postid); { echo ‘<meta http-equiv=”refresh” content=”0; URL= ‘ . get_post_meta($postid, ‘custom-filed-key’, true) . ‘ “>’; }
Since you plan on retrieving and displaying the data ( and most likely wanting to sort it ) then you should store your reviews data in a custom table. All of these fields could be set as integer only: id,comment_id,food,service,location Then you could grab the data by joining this table to the comments table and … Read more
In media library, the images are listed using mysql query which retrieves from your posts table. So it won’t display the folders and sub folders in it. You can create categories and taxonomies to maintain it. If you wish to use plugins. Try some media management plugins. I can suggest you. enhanced media library, media … Read more
Save custom post data outside of default post form
I don’t know if you need to hide the element completely, as in “never display it”, or if you need to hide it conditionally with JavaScript– say, to get a toggle effect. Either case is similar and would use get_post_meta(). To conditionally display the data use something like: $m = get_post_meta(get_the_ID(),’my_meta_key’); if(!empty($m)) { echo ‘<div>your … Read more
custom field images do not display until page save
I found a function to get the Meta ID by Meta Key. This allowed me to correctly assign my $meta_ID variable, and now the delete ajax button works perfectly. No need to update the save function at all. function get_mid_by_key( $post_id, $meta_key ) { global $wpdb; $mid = $wpdb->get_var( $wpdb->prepare(“SELECT meta_id FROM $wpdb->postmeta WHERE post_id … Read more