How to retrieve the post featured image (thumbnail) ID in Gutenberg blocks?

I think you’re looking for: const featuredImageId = wp.data.select( ‘core/editor’ ) .getEditedPostAttribute( ‘featured_media’ ); to get the ID of the featured image and then for the corresponding media object: const media = featuredImageId ? wp.data.select( ‘core’).getMedia( featuredImageId ) : null; See e.g. here in the post featured image component: https://github.com/WordPress/gutenberg/blob/57c2ab37a872b63de215205458336b7fd6c9739d/packages/editor/src/components/post-featured-image/index.js#L105

Post Thumbnails multiple sizes

Simply naming the size in the functions file is not enough to get the sizes to work: To call a custom size that you added do this: <?php the_post_thumbnail(‘category’); ?> I see you set_post_thumbnail_size(200, 200, true) which you don’t need to do if you’re also naming a post thumnail size the same sizes for homepage. … Read more

Featured Image missing in WordPress 3.2 Admin

For me, “Featured Image” was still missing from the Screen Options tab, even after clearing the cache and restarting the browser. In my case the problem was related to having a WordPress 3.2 Multisite install. With this setup, the Media upload buttons must be checked in Network Admin to enable the featured image meta box … Read more

How to add post featured image url to inline background url()?

You just need to retrieve the src attribute of the thumbnail: $thumb_src = wp_get_attachment_image_src ( get_post_thumbnail_id(‘thumbnail’)); $thumb_src is then an array containg the url, width and height of the thumbnail image. So something like… <div style=”background: url(<?php echo $thumb_src[0];?> ) !important;”>adasdasdasd </div> should work.

Use post thumbnail as div background

<div<?php if ( $thumbnail_id = get_post_thumbnail_id() ) { if ( $image_src = wp_get_attachment_image_src( $thumbnail_id, ‘normal-bg’ ) ) printf( ‘ style=”background-image: url(%s);”‘, $image_src[0] ); } ?>> Code should be pretty self explanatory – codex on wp_get_attachment_image_src. As for how I’ve formatted it; I find this the cleanest, easiest to read, without outputting unnecessary whitespace: <div style=”background-image: … Read more

Call Featured Image from Parent Page

I believe you want something like the following: <?php if( has_post_thumbnail( $post->post_parent ) ) { echo get_the_post_thumbnail( $post->post_parent ); } ?> Calling the_post_thumbnail(); should return the current post thumbnail, whereas using get_the_post_thumbnail(); will allow you to specify the ID, using the parent ID in your case. Function Reference for get_the_post_thumbnail() Also, if you’re doing this … Read more

Remove link from post images

This should do the trick. The filter will check for images and removes the a (link) tag. Just add it to your theme’s functions.php: add_filter( ‘the_content’, ‘attachment_image_link_remove_filter’ ); function attachment_image_link_remove_filter( $content ) { $content = preg_replace( array(‘{<a(.*?)(wp-att|wp-content/uploads)[^>]*><img}’, ‘{ wp-image-[0-9]*” /></a>}’), array(‘<img’,'” />’), $content ); return $content; }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)