Image alt attribute
Image alt attribute
Image alt attribute
Sorry for late reply, already fixed, i miss understood about array, so here the code that completely run as i want it. <?php $next_post = get_next_post(); next_post_link(‘%link’, get_the_post_thumbnail($next_post->ID, ‘prev_next_img’, array( ‘class’ => ’rounded-lg object-fill w-full max-h-full’ )) . ‘<h4 class=”text-center mt-2 lg:text-base text-sm no-underline text-black leading-snug font-medium”>%title</h4>’, false); ?> in function.php i put custome image … Read more
You can try wp_get_attachment_image_src this for getting Feature Image URL. Here is the Full code. <?php function propertunity_featured_post() { $featured_post_id = 2860; $featured_post = get_post($featured_post_id); $featured_post_url = get_permalink($featured_post_id); $featured_post_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($featured_post_id, ‘thumbnail’) ); echo “<div class=”card”> <div class=”card-header” style=”background-color: #f8f8fc; overflow: hidden;”> <a href=”” . $featured_post_url . “”> <div class=”card__image” style=”background-image: url(” ” . … Read more
I see 2 problems in your last part. You didn’t add hook for the code. Without it, I doubt that the add_image_size function will be executed. I suggest you wrap it in another function and add to after_setup_theme hook with add_action function. I think the way you use function_exists is unnecessary. With the way you … Read more
Thumbnails and images in the blog post are not loading
This could be a dumb idea, but what if you set it to add_image_size(‘gallery-image’, 9999, 600); As long as you don’t add ‘true’ it won’t crop, it scales to fit into the space by default. It would then try to fit into the smaller of the two, the height in this case, and scale down … Read more
By using post id you can get post type of current post/page. try below code. i have tested and it is working fine for me. add_filter( ‘admin_post_thumbnail_html’, ‘foo’,10,3 ); function foo( $content, $post_id, $thumbnail_id ) { if ( get_post_type( $post_id ) == ‘page’ ) { $content=”<p>foobar</p>” . $content; } else{ $content=”<p>barfoo</p>” . $content; } return … Read more
WordPress create thumbnails on demand
I believe you need to use set_post_thumbnail to actually set featured image: set_post_thumbnail($_POST[‘post_id’], $attachment_id);
Try this code: add_filter( ‘amp_post_template_data’, ‘xyz_amp_remove_featured_image’ ); function xyz_amp_remove_featured_image( $data ) { $data[‘featured_image’] = false; return $data; } More info about the amp hooks here https://amp-wp.org/documentation/how-the-plugin-works/classic-templates/