How to add text & call to action button to featured image on homepage?

If your theme allow you to edit the text displayed on your home page, when you just need to add a a link. A click to call link is a simple HTML link, except that the value of the href attribute needs to refer to the “tel” protocol: <a href=”https://wordpress.stackexchange.com/questions/278772/tel:XXXXXXXXXXXXX”>Call Us</a> Where “XXXXXXXXXXXXX” is your … Read more

Display featured image metadata?

The featured image is just an attachment, and you can retrieve its post ID via get_post_thumbnail_id, e.g. $featured_image_id = get_post_thumbnail_id( $post ); At which point you’re dealing with a standard post of type attachment. Other than checking that there is a featured image, no special handling is needed and it can be treated as any … Read more

How to modify Media Library images DPI [ image quality down to make small in size ] [closed]

DPI (as saved in image metadata) does not really apply to displays since pixel density is property of hardware. You can fake this by resizing image with smaller dimensions in HTML, but saving with higher JPEG compression might make more sense. Default compression level WP uses is 90 (out of 100) and it can be … Read more

How to display recent posts on home page with title, post date, author and featured image?

The functions you are looking for, are: the_post_thumbnail_url(); // For featured image the_author(); // For author name get_author_posts_url(); // For author link the_date(); // For post’s date So, your code should be something like this: <div class=”cs-post-carousel-layout”> <div class=”cs-container swiper-container”> <div class=”swiper-wrapper”><?php // define query arguments $args = array( ‘posts_per_page’ => 5, // your ‘x’ … Read more

Change background image in PHP

You won’t be able to delete the image per se, but using CSS you can hide the image. You should also make sure you fix the typo inside of your inline style it should read background-image: url(…). For the varying styles, you can utilize media queries to hide at a certain point. I don’t recommend … Read more

Convert thumbnail ID into image URL

There are two functions you can use for this: wp_get_attachment_url to get the full sized image or wp_get_attachment_thumb_url, which gets the url of the thumbnail of that attachment. Either function takes the attachment id as the sole argument: $attachment_id= 25; //Get the full url $url = wp_get_attachment_url( $attachment_id ); //get the thumbnail $thumb = wp_get_attachment_thumb_url( … Read more

Different thumbnail size than actual picture in post

This is quite simple to implement, using core post-thumbnails functionality. First, you need to add Theme support for the feature, via functions.php: <?php function wpse54920_setup_theme() { // Support post thumbnails add_theme_support( ‘post-thumbnails’ ); } add_action( ‘after_setup_theme’, ‘wpse54920_setup_theme’ ); ?> Next, you need to define your custom image sizes, using add_image_size(). Let’s say you want the … Read more