If YouTube Link in Excerpt use Featured Image as Video using Excerpt Link in Text Else Get Featured Image
If YouTube Link in Excerpt use Featured Image as Video using Excerpt Link in Text Else Get Featured Image
If YouTube Link in Excerpt use Featured Image as Video using Excerpt Link in Text Else Get Featured Image
After a thorough inspection of the database, i saw that the post_type for the images had changed to “post” instead of “attachment“. The solution Update Post mime type from “post_status = inherit” sql: // Mime type – img/jpeg UPDATE wp_posts SET post_type = ‘attachment’ WHERE wp_posts.post_status = ‘inherit’ and wp_posts.post_mime_type = ‘image/jpeg’; // Mime type – img/png UPDATE wp_posts SET post_type = ‘attachment’ WHERE wp_posts.post_status = ‘inherit’ and wp_posts.post_mime_type = ‘image/png’; // Mime type – img/webp UPDATE wp_posts SET post_type = ‘attachment’ WHERE wp_posts.post_status = ‘inherit’ and wp_posts.post_mime_type = ‘image/webp’; // Mime type – … Read more
The $attr argument to get_the_post_thumbnail() is optional, so the default value is an empty string. If it’s called with no $attr argument, it passes the same empty string through to wp_get_attachment_image(), which returns the markup for an <img> element with an empty alt attribute. This is default behaviour. If you wanted to override this behaviour … Read more
WordPress does not have a built-in hook or function on the PHP side that allows you to directly add a new tab to the Media Library Modal window. To achieve this, you need to use JavaScript to modify the media uploader interface. You can add a custom tab to the WordPress Media Library modal by … Read more
I saw this problem recently on a project, and the answer is to disable responsive image markup. Simply add the below code into your theme’s functions.php and you are golden: add_filter( ‘wp_calculate_image_srcset’, ‘__return_false’ ); Ref: How do I disable responsive images in WP 4.4? Afterwards, you can insert the Medium Large a.k.a. medium_large images (if … Read more
WordPress does not have its own function for this yet. You can do this with a plugin https://wordpress.org/plugins/search/Featured+Video/
You will want to make the following changes to your add_custom_field_automatically function. First, we will need to add the global $post; as we will need the $post variable inside the function scope. You do this with a comma. more on variable scope here. add_action(‘publish_post’, ‘add_custom_field_automatically’); function add_custom_field_automatically($post_ID) { global $wpdb, $post; if(!wp_is_post_revision($post_ID)) { add_post_meta($post_ID, ‘field-name’, … Read more
Rather than messing with it yourself, this is a great scenario in which to consider offloading it to a third party (and also using modern formats like WebP). Something like PicPerf.io or other optimization plugins out there.
Using CSS, you can try just moving the ‘hover’ state a bit higher up the chain. .brbl-blog-item:hover .brbl-overlay{ /*Theme has this set to `transparent` so change to 70% white*/ background: RGBA(255,255,255,0.7); z-index: 1; } .brbl-blog-item:hover .brbl-post-btn{ opacity: 1; z-index: 10; } This does mean that the entire item including the content is subject to the … Read more
Try this: function wrapPostFeaturedImage( OriginalComponent ) { const currentPostType = wp.data.select( ‘core/editor’ ).getCurrentPostType(); // Do nothing, if the post type is not rt_brands. if ( ‘rt_brands’ !== currentPostType ) { return OriginalComponent; } return function( props ) { // Your code here. }; } You can also: Conditionally add your filter: // Check if the … Read more