WordPress supports Post Thumbnails (also known as Featured Images) to visually represent posts, pages, or custom post types. On ruachost.com, you can enable and display thumbnails in your theme with a few simple steps.

 

Why Use Thumbnails?

  • Improves the look of your blog by adding visuals.

  • Helps readers quickly identify posts.

  • Essential for magazine‑style layouts and grid designs.

  • Increases engagement and click‑through rates.

 

Enabling Thumbnails in Your Theme

  1. Log in to WordPress with an administrator account.

  2. In the dashboard, go to Appearance → Theme Editor.

  3. Select your active theme and open the functions.php file.

  4. Add the following code snippet:

    // Enable featured images (post thumbnails)
    add_theme_support('post-thumbnails');
    
  5. Click Update File to save changes.

✅ Your theme now supports featured images.

 

Displaying Thumbnails in Blog Posts

  1. Open the template file where you want thumbnails to appear (e.g., index.php, single.php, or content.php).

  2. Insert the following code inside the post loop:

    <?php if (has_post_thumbnail()) {
        the_post_thumbnail('thumbnail'); // Options: 'thumbnail', 'medium', 'large', 'full'
    } ?>
    
  3. Save changes.

  4. Go to Posts → Add New or edit an existing post.

  5. In the editor sidebar, set a Featured Image.

✅ The thumbnail will now display with your blog posts.

 

⚙️ Customizing Thumbnail Sizes

You can define custom sizes in functions.php:

// Add custom thumbnail size
add_image_size('custom-thumb', 300, 200, true); // width, height, crop
 

Then call it in your template:

the_post_thumbnail('custom-thumb');
 

Important Notes

  • Always back up your theme files before editing.

  • Use a child theme to preserve changes during updates.

  • Thumbnails may need regeneration if you change sizes (use the “Regenerate Thumbnails” plugin).

  • Featured images are theme‑dependent, some themes already include support.

Je li Vam ovaj odgovor pomogao? 0 Korisnici koji smatraju članak korisnim (0 Glasovi)

Powered by WHMCompleteSolution