Underscores.me retrieve next / previous post thumbnail in post_nav function

I solved the problem by using get_the_post_thumbnail() instead of the variables $prevthumbnail and $nextthumbnail. function THEMENAME_post_nav() { // Don’t print empty markup if there’s nowhere to navigate. $previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, ”, true ); $next = get_adjacent_post( false, ”, false ); if ( ! $next && ! … Read more

Is it possible to get local image URL when also having photon active?

Definitely a hack solution, but the only one I know got to work thus far… <?php $bkg_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘single_post_thumbnail’ ); ?> <style> span { background-image: url(‘<?php echo preg_replace(“/\.jpg.*/”, “-50×50.jpg”, $bkg_image[0]); ?>’); } </style> Basically, I am fetching the non-photon URL, and doing a string replace of the end image URL ‘.jpg’ … Read more

Cannot get full thumbnail size using the_post_thumbnail

Try to add custom thumbnail size with unlimited(very big) hegiht and width in functions.php with following code: add_theme_support( ‘post-thumbnails’ ); add_image_size( ‘custom’, 9999, 9999 ); It will not crop any images. So you can use it as the_post_thumbnail( ‘custom’ ); This method looks rough but you can use if other ways don’t work. And if … Read more

Add colorpicker to featured image

Okay. Got it working…. I used the simple version: add_filter( ‘admin_post_thumbnail_html’, ‘basic_add_opacity_to_feature_thumb_box’); //same as before function basic_add_opacity_to_feature_thumb_box( $myhtml ) { $selected_option = get_post_meta( get_the_ID(), ‘basic_opacity’, true ); // get the current value for ( $i = 0; $i <= 1; $i = $i + 0.1 ) { //loop from 0 to 1 in 0.1 increments … Read more

Media thumbnail for custom post inside post content

@Ibraheem, you don’t have to use global $post, since it is in global. To check post type you can use get_post_type(). Using the_post_thumbnail is not properly implemented in this case, instead use get_the_post_thumbnail. Note: you can’t use has_post_thumbnail as tag condition if you are not set featured image. add_filter( ‘the_content’, ‘put_thumbnail_in_posting’ ); function put_thumbnail_in_posting( $content … Read more

Use Video as Featured Image

You can work around if you have time. – Install http://ffmpeg-php.sourceforge.net/ – Create a custom meta field (upload field – you can use a plugin) – In your template or loop, get retrieve the uploaded video URL and assign it to a variable – Use the following function to generate an image from the retrieved … Read more

PDF Image in content

There’s no easy way in version 4.8, as far as I know. Few ideas come to mind, regarding writing plugins to make it easier: Use the media_send_to_editor filter to modify the HTML output for the application/pdf mime type, to include the preview image. This makes it is easier for user to insert pdf preview images, … Read more

Shortcode does not work, changes html order

the_post_thumbnail_url() will echo the URL. You should use functions that have get_the_… in the beginning of their names, since functions starting with the_… will generally echo the content. So, your sprintf should use get_the_post_thumbnail_url() like this: $html .= sprintf( ‘<div class=”grid-item”><a href=”https://wordpress.stackexchange.com/questions/278102/%s” title=””>%s</a></div>’, get_the_post_thumbnail_url( get_the_ID(), ‘full’ ), the_title_attribute( ‘echo=0’ ), //get_the_title() //the_post_thumbnail() ); However, in … Read more