Display Page featured Image as well as Posts featured Image

WordPress loop functions depend on the global variables, so you will have to get the data from page before you run the loop. Generally, you should be able to do something like this- $page_id = get_the_ID(); //this is important, we will use this later while(have_posts()): the_post(); //do something with the post here echo get_the_post_thumbnail( $page_id … Read more

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 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

Change image on post title hover (more than one instance) – Jquery

I think you could the code working, if you used the current term as the selector as there’s only one featured image and multiple links for each term. For example, first add the term to the image classes, <img class=”img-fluid ga-img ga-img-<?php echo $term->slug; ?>” src=”https://wordpress.stackexchange.com/questions/366314/<?php echo esc_url($ga_url);?>”> Then add the term to every post … Read more