Tag Info

Hot answers tagged

3

When you are saving the multidimensional array you can use this code: $product_img_path[$count]['wpc_resize_thumb_img'] = $upload_dir['url'].'/'.$resize_img_name; $product_img_path[$count]['wpc_resize_bid_img'] = $upload_dir['url'].'/'.$resize_big_img_name; update_post_meta($post->ID, 'wpc_images', $product_img_path); That way you can get ...


3

Wrong Assumptions @Rarst or @Dan-Cameron answers may work, but assume that when you are viewing a post type editing page, the metaboxes for the other post type are all registered. There are different case in which that won't happen: If metaboxes are registered using "add_meta_boxes_{$post_type}" hook, instead of the more common, generic "add_meta_boxes" ...


3

Before we code and go into particulars, lets look at the problem at hand. First of all, any valid date format is valid in a custom field if you are not going to use it for comparisons and sorting When you are going to sort by date or do comparisons by date in a custom field, bullet point one should be ignored. There are only two workable formats which will ...


2

The WP_Query() only queries posts from the wp_posts table. Even if you add additional parameters such as: 'meta_query' => array( array( 'key' => '_thumbnail_id' 'compare' => 'EXISTS' ) ) It looks at the wp_postmeta table to ensure that the posts it pulls has the post_meta _thumbnail_id but it does not also pull the ...


2

This works fine if I'm only returning data for a single meta key...but fails if I want to return all of the meta data, but return them all as strings (single). This doesn't make a lot of sense. A function in PHP can only return a single value so there is no way to return all meta as strings (plural). It has to come out as an array, or an object. And ...


1

If it's created with ACF, then the way to call the field is like this: $can_download = get_field('enable_downloads',$postid); so your code should look like: <?php global $wp_query; $postid = $wp_query->post->ID; $can_download = get_field('enable_downloads',$postid); if ($can_download == 'yes') { ...



Only top voted, non community-wiki answers of a minimum length are eligible