Articles of custom field

Unable to save datetime custom meta field using update_post_meta() function

When I do something like this (in my plugin function inside WP admin): $metaboxes = get_post_meta( $post_id ); echo “<pre>”; print_r($metaboxes); echo “</pre>”; die(); I get all my metaboxes info except the datetime. Why is that? Where are they stored and how can I access them? I am using this plugin to add custom […]

Filter out posts before display category count

I have meta key “Due” for posts….if a post has expired (past the current date or not equal to it) then it should not be displayed in the count (i have code to display the count, which fades in over a thumbnail)..for example right now one says it has 89, but it should really only […]

little help with a mySQL query to wp database

@t31os gave a very helpful response to: getting all values for a custom field key (cross-post) by providing this function if ( ! function_exists( ‘get_meta_values’ ) ) { function get_meta_values( $key = ”, $type = ‘post’, $status = ‘publish’ ) { global $wpdb; if( empty( $key ) ) return; $r = $wpdb->get_col( $wpdb->prepare( ” SELECT […]

Compare WP Custom Field date

I had create a custom field “date” with this format 16/09/2013 (d/m/Y). How can i compare date and show only post with date from today ? This is my query that don’t work !! $args = array( ‘posts_per_page’ => 100, ‘meta_key’ => ‘date’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘ASC’, ‘meta_query’ => array( array( ‘key’ => […]

Arrange custom fields with drag and drop?

I am making theme for hotel and i made custom metabox with list of various custom fields that i would need in posts. What i did is i made a list of fields like booking wifienabled coffe pool spa and so on… Problem is that currently i can show those custom fields in website frontend […]

Sort by posts that have a featured image?

I’d like to sort posts on the index page to show those that have a featured image first. I’ve done this in functions.php: add_filter( ‘pre_get_posts’, ‘my_get_posts’ ); function my_get_posts( $query ) { if ( is_home() || is_archive() ) { $query->set(‘orderby’, ‘meta_value’); $query->set(‘meta_key’, ‘_wp_attached_file’); } } The causes no posts to be shown on the index […]

WP Query group/order by category name

I have a requirement for displaying a list of custom post types grouped by category, but in addition to this, each custom post is linked with a meta value (in this example lets say we have a custom meta value of “TEST1”). Basically, my goal is to display a list, grouped by category for all […]

Guest Author – How can I use custom fields to create guest author link?

We are posting articles authored by guest authors. The guest authors will not be logging in to the site, and we don’t want to create users for these guest authors. We are also not interested in any of the guest blogger plugins for MANY reasons.. To display the guest authors name in the guest posts, […]

Using Custom Function With Advanced Custom Fields

I’ve written a custom function which works with the native WordPress custom fields function but I need it to work with the Advanced Custom Fields plugin. I have created the custom field and meta box using the plugin and added the function to my child theme’s functions.php file. I am using the field name (demo_field) […]

How to Display ACF Relationship Custom Field as Link to Specific Custom Post?

OK. I am reading this ACF tutorials, but I am not getting into this. I have 2 post types: Lists and Contacts. Every List must be related to some Contact, and I use Relationship custom field type (list_supplier), which is limited to only one choice (or Contact). All I have to do is to display […]