Hide Heading if ACF Field is empty

Move the outer(of the two) div.local_faq inside the if statement which checks if the faq field is set, because that’s the outer parent container. Also it would make sense to change the outer container div to have a plural div.local_faqsclass instead of the same class as the nested div.local_faq Then just add the h3 part … Read more

How to inherit field value from parent post into in child / sub post

You can use get_post_field( ‘post_parent’ ) to get the parent ID of the current post. Whilst ACF is technically off-topic, FWIW you can pass the ID of a post as the second parameter to get_field. Combined together we can fashion a shortcode centre_field that will return any field value for the post’s parent. I’ve skipped … Read more

How to conditionally add Custom Post Type to Front Page

I believe that if all your products have the custom meta field show_on_front_page with some containing ‘1’ and some containing ‘0’ or some such, AND your regular posts do not have that field, then something like below should work: //… $query->set(‘post_type’, array(‘post’, ‘product’)); //add this $meta_key = ‘show_on_front_page’; $query->set(‘meta_query’, array( ‘relation’ => ‘OR’, array( ‘key’ … Read more

wp custom field date format compare

Hi @idontknowhow: You’ve focused on trying to solve the problem in PHP when in fact you needed to focus on the SQL. Your first problem was you reversed the “polarity” (which is a term I made up just now, but it kinda fits); you were looking for both a start date that was greater than … Read more

Amazon.com intergration with WordPress?

You’re looking for something a little more advanced than a simple affiliate integration. Unfortunately, I don’t thing there’s an existing plug-in solution for the kind of interaction you’re trying to achieve. That said, it should still be possible. A cursory search turned up Amazon’s Product Advertising API, which seems to be exactly what you’ll need. … Read more

How to make a pulldown menu display custom meta terms in a theme?

Still not sure what exactly what you aiming for, but having come back to this question i wanted to at least try to offer a solution. So try this out, and see if that’s the kind of thing you had in mind with the dropdown… ? add_action( ‘add_meta_boxes’, ‘add_inventory_metaboxes’ ); function add_inventory_metaboxes() { add_meta_box(‘inventory_information’, ‘Inventory … Read more

Copy price categories to custom field

paste this code in you theme’s function.php file //get all categorie ID’s in to array $args = array( ‘child_of’ => 3678); // Parent category ID $categories = get_categories( $args ); $cat_array = array(); foreach ($categories as $category) { $cat_array[] = $category->term_id; } $Query_args = array( ‘category__in’ => $cat_array, ‘post_type’ => ‘YOUR_POST_TYPE_NAME’ ); $new_query = new … Read more