Retrive Image URL of Custom Fields in Theme
you could just say: get_the_post_thumbnail(”, ‘full’) just from the id itself since this is a custom meta. wp_get_attachment_image($project->project_image, ‘full’)
you could just say: get_the_post_thumbnail(”, ‘full’) just from the id itself since this is a custom meta. wp_get_attachment_image($project->project_image, ‘full’)
During the creation of the custom post, did you add the support? ‘support’ => array(‘title’, ‘editor’, ‘excerpt’, ‘thumbnail’, ‘revisions’),
You can do this by using something similar <?php //Post we need to update $id = 37; $custom_field = get_post_meta( $id, ‘custom_field_key’, true ); // Update post 37 $mg_post = array( ‘ID’ => $id, ‘post_content’ => $custom_field, ); // Update the post into the database wp_update_post( $mg_post ); //Delete the custom field delete_post_meta( $id, ‘custom_field_key’ … Read more
As written your question is off-topic, as it is purely SQL-related. However, the following 2 solutions translate it into WP-ese. Solution 1 $args = array ( ‘post_type’ => ‘project’, ‘post_status’ => ‘publish’, ‘s’ => ‘testingsearch’, ‘meta_query’ => array ( ‘relation’ => ‘OR’, ‘project_date’ => array ( ‘key’ => ‘project_date’, ‘compare’ => ‘EXISTS’, ), array ( … Read more
Here is something I use generally.. Please refer this link . and follow. This will help you definitel thanks
You’re getting close on your second guess, but I think a better way would be to create your own custom field checkbox that displays in the existing featured image meta box. This makes the functionality nice and obvious from a usability perspective, and operates on a post by post basis as desired. I put together … Read more
Try this code at the place where you want your gallery: <?php $images = acf_photo_gallery(‘gallery_images’, $post->ID); /// gallery_images to slug pola galeria w ACF if( count($images) ): foreach($images as $image): $full_image_url= $image[‘full_image_url’]; $class = get_field(‘gallery_images_class’, $id); echo ‘<img src=”‘.$image[‘full_image_url’].'” class=”‘.$class.'” >’; endforeach; endif; ?> Do try to check if ‘$id’ gives you the image/post id … Read more
Try and remove the_post_thumbnail function from the img tag. On its own the_post_thumbnail prints out the img tag so there seems to be two img tag ending in your script.
Thanks for your help guys. They didn’t quit work exactly, but I managed to get the result I needed by doing the following $reviewsNum = 0; $reviewsCount = 0; $argsSchema = array( ‘post_type’ => ‘reviews’, ‘posts_per_page’ => -1 ); $loopSchema = new WP_Query( $argsSchema ); $count_reviews = wp_count_posts( ‘reviews’ )->publish; while ( $loopSchema->have_posts() ) : … Read more
Use the_content filter to add your fields to the output of the_content() function: function wpd_content_filter( $content ) { if ( ‘your_custom_type’ == get_post_type() ){ if( $meta = get_post_meta( get_the_ID(), ‘foo_meta’, true ) ) { $content = $content . $meta; } } return $content; } add_filter( ‘the_content’, ‘wpd_content_filter’ );