Skip to main content Skip to footer
  • Home
  • About
  • Services
  • Work
    • Web Development
    • Portfolio
  • Contact
  • Blog
    • ACF
    • Beaver
      • Beaver Builder
      • Beaver Theme
      • Beaver Themer
    • Genesis
    • jQuery
    • macOS
    • WordPress
    • WooCommerce
  • Home
  • About
  • Services
  • Work
    • Web Development
    • Portfolio
  • Contact
  • Blog
    • ACF
    • Beaver
      • Beaver Builder
      • Beaver Theme
      • Beaver Themer
    • Genesis
    • jQuery
    • macOS
    • WordPress
    • WooCommerce

Add a Class to a Featured Image in WordPress

March 2, 2016| 1 comment

You can add a CSS class to a featured image in WordPress using an array in the_post_thumbnail

 

 if( has_post_thumbnail() ) {
//Add in featured image & class
 the_post_thumbnail( 'featured-podcast', array( 'class' => 'alignnone' ) ); 
 }


This can be handy for coding out a custom loop.

Categorised

  • css
  • featured image
  • the_post_thumbnail

Related Posts

  • Fail2ban Wordpress Runcloud

    Block wp-login.php and xmlrpc.php via fail2ban on RunCloud

  • Remove Post Info and Meta in Learn Dash Custom Post Types

  • Learndash Login Redirect

    Add LearnDash Custom URL Login and Logout Custom Redirects

  • Bricks Builder Spinning Icon

    Bricks Builder Add Spinning Icon to Ajax Add to Cart Button on WooCommerce Product Archive

  • Cloudflare Custom Rules

    Block xmlrpc.php requests from Cloudflares firewall using Custom or Rate Limiting Rule

  • Cloudflare Fail2ban Serverpilot

    Syncing RunCloud and Cloudflare firewalls for fail2ban IPs

  • Cron Wordpress

    Set up WordPress cron to run via server cron in cPanel, Cloudways and RunCloud

  • Pre Get Posts Display

    Change Number of Posts Displaying on a Custom Post Type (CPT) Archive Page

Related Posts

  • Fail2ban Wordpress Runcloud

    Block wp-login.php and xmlrpc.php via fail2ban on RunCloud

  • Remove Post Info and Meta in Learn Dash Custom Post Types

  • Learndash Login Redirect

    Add LearnDash Custom URL Login and Logout Custom Redirects

  • Bricks Builder Spinning Icon

    Bricks Builder Add Spinning Icon to Ajax Add to Cart Button on WooCommerce Product Archive

1 comment

  • Sean Vandenberg
    10 years ago Reply

    Yes, yes, very useful. Thanks again, Neil. Always saving my day!

Leave your comment (Cancel Reply)


  • Get Beaver Builder Now!
  • ACF apache archive beaver beaver builder beaver theme beaver themer bootstrap cache category checkout cpt css customizer filter flexbox form genesis header homebrew htaccess iconfonts image javascript jquery loop markup menu mysql php pre_get_posts repeater runcloud serverpilot shortcode slider taxonomy template twentytwelve ubuntu UI/UX while widget woocommerce wp-cli

  • Donate

    If you found something that helped you out and would like to make a donation, that's great, click below

  • PowerPack Beaver Builder Addon

Our location

We are based in the Northern Beaches of Sydney and work with both local and overseas based clients.

Check us out

Work with us

Let us know your website project requirements, see our services and use the contact form to get in touch to start the ball rolling.

  • Home
  • Blog
  • About
  • Services

© 2017 · NEIL GOWRAN · POWERED BY WORDPRESS, BRICKS, OPEN LITESPEED, CLOUDFLARE AND HOSTED ON RUNCLOUD AND RACKNERD