<?php /* Set the name of the category and the number os posts to be displayed */?>
<?php $first_query = new WP_Query('category_name=name&posts_per_page=7'); ?>
<?php /* Show the posts */ ?>
<?php while ($first_query->have_posts()) : $first_query->the_post(); ?>
<?php /* Make the hiperlink to the post */ ?>
<a href="https://wordpress.stackexchange.com/questions/59934/<?php the_permalink(); ?>">
<?php /* Get the featured post image */ ?>
<div class="post-image"> <?php /* This div is just for help you to organize your posts images */ ?>
<?php the_post_thumbnail(); ?>
</div>
</a>
<?php endwhile; // End the loop. Whew. ?>
In the second line, chose the name of the category, and the number of posts that will be displayed in this page. The function get the featured post image and insert into your webpage.
Related Posts:
- Missing feature image link function
- Automatically set the featured image
- Get recent posts with thumbnail
- How to display the_post_thumbnail if a post has one or otherwise display the first image in a post?
- Add options to featured image
- Linking thumbnail to full size image
- Generating Responsive Background Image Sizes in PHP
- Why are image thumbnails cropped proportionally (not per dimensions)?
- Add a Post Thumbnail to an RSS Feed with custom size
- Automated mark posts as featured every day
- Make WordPress size and name images for Retina.js
- Why are image thumbnails cropped proportionally (not per dimensions)?
- the_post_thumbnail fallback using hooks
- Display height and width properties with the_post_thumbnail() or related function
- Setting featured image with function, 1 part not working
- Removing the first image in content
- How to set the jpg image compression for specific thumbnail sizes?
- Function to auto-set a featured image that is already in use
- img width and height attributes being set by get_the_post_thumbnail
- How to display a default image for post thumbnail using functions.php?
- Change size and crop medium_large images
- Getting Featured Image Caption to Only Show if Populated
- wp_get_attachment_image function size argument not working if I also add a custom class
- Can’t check if a post has thumbnail adding filter to get_post_metadata()
- Add Featured image column into wordpress admin on pages AND posts
- Post thumbnail not showing in WP admin area for custom post type
- Overwriting Parent Theme’s Image Sizes
- Backstretch.js and thumbnail sizes to reduce loading time
- set_post_thumbnail when user is not logged in
- How to stop twenty fifteen theme from cropping featured images?
- Can you put a condition on add_image_size() depending on the width of the uploaded image?
- show first 3 thumbnails of posts in different sizes [closed]
- How do I create a function that simulate the click on Update button for all posts?
- Set spesific size of featured images
- Can’t generate thumbnail images
- It does not work concatenation in function.php
- How to retrieve the current post’s generated featured image size?
- Check if the image size is available and if not use ‘full’ image size
- is there a way to remove featured image from blog page and single page
- How to hide image-url if no attachment?
- Can set_post_thumbnail be used to remove a thumbnail?
- Can’t locate custom image sizes defined by child theme
- How to add a new image size and apply it to posts only?
- Show Featured Image in else statement
- Change custom featured image size in twentythirteen child theme
- resizing of thumbnails not working
- Featured Image keeps cropping
- show all the posts thumbnails
- struggling with syntax for the_post_thumbnail();
- include w_thumbnail_src in function?
- Custom image sizes showing in Classic Editor only when upladed directly to post
- Which filter fires upon setting a featured image
- Can I use ‘Featured Image’ as a hero image and a thumbnail?
- remove_filter function to unhook twentysixteen parent theme function
- Can You Set A Minimum Image Dimension For Resizing Images?
- Featured image on archive page based on post type
- Printing medium sized image
- Sticky – Featured Image
- Frontend Feature image upload not work
- Best way to add image to recent posts widget?
- Slider Thumbnail Size Issue [closed]
- Remove Featured Images from Posts Older Than a Certain Date
- Apply height and width for the_content() inside youtube video tag
- Set thumbnail from URL, by grabbing image in functions.php
- add_theme_support not outputting thumbnails
- Full size image option removing problem
- Image width issue in IE [closed]
- image_size with respect to aspect ratios
- Is mytheme_post_thumbnails() still necessary?
- Second featured image only shows in metabox preview after saving a post in the wordpress editor
- No src and sizes attributes present on WordPress thumbnail images; the smallest image size is loaded irregardless of viewport size
- Is there any global functions.php file which works for any theme?
- When should you, and when should you not, use wp_list_pluck()?
- Include PHP file in Content using [shortcode]
- Gettext details
- current_cat_ancestor Alternatives
- Add body class of category parent
- Roles & capabilities GUI that does not create separate table
- Why get_header() or get_footer() does not run twice if called in the same php file?
- Max file size not updating
- Create thumbnail on PDF upload with Gravity Forms
- How to override filter in child theme?
- Use Exact Image Size using add_image_size
- How can I tell when a user is logged in?
- Enqueue Style in Functions.php
- Different functions file for each site in multisite installation?
- jQuery plugin function is not a function
- Limit posts only on home page – ideally in functions.php
- Make Categories a Dropdown Menu in Media Library
- How to make thumbnail image fit into a div where image dimentions are completely different?
- Loop (iterate) through Multi-Site sub-sites (blogs)?
- Proper way of using functions in action hook?
- Create single.php for specific tag by tag id or name
- function to erase swear words
- Using $themename Variables
- How to add a slide toggle to the Woocommerce-Layout__Activity-Panel area in the orders admin page
- How to auto refresh when user change postcode
- Add sequential number to a Gravityforms form
- wp-comment author- url +, email filter hook
- how can I just add to parent theme function(s) instead of redeclaring whole the function