Add title to image post

Sorry, but I don’t see any of those parameters in the parameter list for wp_get_recent_posts. $args = array( ‘numberposts’ => 10, ‘offset’ => 0, ‘category’ => 0, ‘orderby’ => ‘post_date’, ‘order’ => ‘DESC’, ‘include’ => , ‘exclude’ => , ‘meta_key’ => , ‘meta_value’ =>, ‘post_type’ => ‘post’, ‘post_status’ => ‘draft, publish, future, pending, private’, ‘suppress_filters’ … Read more

Add image size array to a portfolio thumbnail in combination with Masonry Jquery Plugin

the_post_thumbnail() only retrieves the specified thumbnail size for the current post. You’ll need to write a conditional function or use a custom query to randomize the posts shown or thumbnail sizes from your theme’s loop. If you are familiar with where your loop starts, then: $tile_sizes = array(‘small’,’medium’,’category-thumb’); LOOP STARTS $random_size = rand(0,2); $chosen_size = … Read more

How To Use YouTube Url Stored In Custom Field To Get Video Image and Set it As Featured Image

function set_youtube_as_featured_image($post_id) { if( has_post_thumbnail($post_id) ) return; $url = get_post_meta($post_id, ‘ci_cpt_video_link’, true); if ( $url && filter_var($url, FILTER_VALIDATE_URL) ) { // getting thumb url from video url parse_str( parse_url( $url, PHP_URL_QUERY ), $youtube_vars ); $youtube_id = $youtube_vars[‘v’]; $youtube_thumb_url=”http://img.youtube.com/vi/” . $youtube_id . ‘/0.jpg’; // download and save thumb $get = wp_remote_get( $youtube_thumb_url ); $mime_type = wp_remote_retrieve_header( … Read more

How to get featured image thumbnail to open larger version in attachment page?

Use get_attachment_link to get a link to the attachment page or take a look at wp_get_attachment_link which might simplify the process. <?php if(has_post_thumbnail()) : ?> <div class=”spudpictureandcontentwrapper”> <div class=”illustration”><?php $attachment_id = get_post_thumbnail_id(); $large_image_url = wp_get_attachment_image_src($attachment_id, ‘large’); $attachment_page = get_attachment_link($attachment_id); echo ‘<a href=”‘ . esc_url($attachment_page) . ‘” title=”‘ . esc_attr(get_the_title($attachment_id)) . ‘” >’; the_post_thumbnail(‘thumbnail’); ?> </a></div> … Read more

Default thumb – how to set it

While there’s no such functionality built into core, there’s a Track Ticket I proposed 2 years ago. You can simply rip of the functionality from the suggested wp_default_img() function. I’ll greatly appreciate any support in comments on that ticket, as this would be highly needed for every theme developer. Thanks in advance. MU-Plugin The following … Read more