Articles of custom field

How to check if user meta field is empty in conditional else statement

Hello all I have a custom post type set up for my wordpress site within this custom post type i have a meta box with about 11 meta fields that I have added programatically. What I would like to do is check if one of the fields (which i have programmed to be a radio […]

WP_Query custom field pass the post id

I’m using WP_Query with ACF(Advanced Custom Fields) I’m building a news portal, and I’m trying to pass related stories from 1 post which is top_story = true. In another WP_Query I want to print the related articles to the post_id which is top_story and the id of that post, which normally can change. My queries […]

How to add the post ID (or any other post data) to a Contact Form 7 mail?

I’ve downloaded Contact Form 7 to add contact forms adding a simple snippet after every post, and I’ve added it in functions.php like this : //if post type I add a form function is_post_type($type) { global $wp_query; if($type == get_post_type($wp_query->post->ID)) return true; return false; } function add_post_content($content){ if(!is_feed() && !is_home()&& is_single() && is_post_type(‘post’)) { $content […]

query_posts with meta_value

I have category ‘news’ http://localhost/foldername/news, for each ‘news’ posts I have custom field called ‘years’ and is set up as a Text Field. I have 2 values assigned n different posts ‘2013’ and ‘2014’. What I’m trying to do first to show only 2014 posts in ‘news’ category http://localhost/foldername/news and second to pass url parameter […]

Query using string from custom field as array value

Firstly, what I am trying to do is display posts from Category x on posts from Category y where text from a custom field on post from Cat y matches text from one of 2 custom fields on cat x. I am using Advanced Custom Fields and have a custom text field on each post […]

How to print the Custom fields values

I am working with genesis theme in wordpress. I am created custom fields using Advance Custom field plugin. Now i want to know that how i can print the fields value into my frontend page ?

Admin search ACF relationship

I have a custom post type name story. It has a custom field named ‘select_artist’ with a relationship to a custom post type named artist. Within the story edit page, I want to use the search box to search for the ‘select_artist’ title. At the moment it will only return results when I search for […]

How to show posts rank based on custom field value

I have total 100 posts, 10 posts in each page on homepage with paginatin. Here is my code $args = [ ‘posts_per_page’ => 100, ‘fields’ => ‘ids’, // Add additional args here ]; $post_ids = get_posts( $args ); if ( $post_ids ) { $paged = get_query_var( ‘paged’ ) ? get_query_var( ‘paged’ ) : 1; $args_2 […]

Display post meta conditionally based on it's value

I have a custom field that’s a radio button with 3 choices (yes, no, other). What I’d like to do is the following: [If custom field value is yes] Display something here [elseIf custom field value is no] Display something here [elseIf custom field value is other] [else] The code I have thus far isn’t […]

Make a custom column sortable by a value from a different custom post type

I’ve created some custom columns to display my custom post types more attractively in the admin section – the columns are mostly custom fields. Mostly, this works absolutely fine, and I can sort by the custom field columns as expected. However, one of the custom fields points to the post ID of a different post […]