• Skip to main content

Victor Font Consulting Group, LLC

The DEX Intranet Specialists

Call Us:

+1 919-604-5828

  • Home
  • Care Plans
    • Care Articles
    • Optional Subscriptions
  • Consultations
  • Products
    • Code Snippets
    • Public GitHub Repositories
    • Gist Snippets
    • Pastebin Snippets (Free)
    • Free Plugins
  • FAQs
  • Support
    • Graphic Design
  • Contact
    • Speakers
    • Portfolio
  • Resources
    • Free WordPress Video Training
    • Tutorials
    • Articles
    • Cybersecurity
    • EU Referral Network
You are here: Home / Code Snippet / AddClass to Genesis Featured Post Image

AddClass to Genesis Featured Post Image

By Victor M. Font Jr.
August 22, 20152 Comments

Wildcard Selectors; Public domain image from pixabay.com
Wildcard Selectors

In a comment posted for the article Genesis Framework: Add a Custom CSS Class to Elements, Michael Caiati asked:

I am trying to add a a class to the images in the featured post widget. What would I use to achieve that. I tried genesis_attr_entry-image it did not work. Thanks

Adding the following code to the Genesis/Theme Settings header script area solves his problem:

How This Works

You may not be familiar with the selector used in the jQuery example above. This is a wildcard selector that targets all div elements with an id beginning with “featured post widgets". Wildcard selectors are extremely useful for targeting elements of a specific type. Wildcard selectors work for jQuery and CSS. To learn more about wildcard selectors, please visit http://api.jquery.com/category/selectors/

  • 2shares
  • Facebook0
  • Twitter0
  • Pinterest0
  • LinkedIn2
  • Print
  • SMS0

About Victor M. Font Jr.

Victor M. Font Jr. is an award winning author, entrepreneur, and Senior IT Executive. A Founding Board Member of the North Carolina Executive Roundtable, he has served on the Board of Advisors, of the North Carolina Technology Association, the International Institute of Business Analysis, Association of Information Technology Professionals, Toastmasters International, and the North Carolina Commission for Mental Health, Developmental Disabilities, and Substance Abuse Services. He is author of several books including The Ultimate Guide to the SDLC and Winning With WordPress Basics, and Cybersecurity.

Reader Interactions

VictorFont.com runs on the Genesis Framework

Genesis FrameworkThe Genesis Framework empowers you to quickly and easily build incredible websites with WordPress. Genesis provides the secure and search-engine-optimized foundation that takes WordPress to places you never thought it could go.

Check out the incredible features and the selection of designs. It's that simple—start using Genesis now!

Click here to download The Genesis Guide for Absolute Beginners (PDF - 1.4 MB)

Leave a Reply Cancel reply

Your email address and website will not be published. Required fields are marked *
Posting a comment means that you agree with and accept our Comment & Product Review Policy

Comments

  1. Chinmoy Paul

    August 22, 2015 at 11:13 am

    If you are using Genesis 2.1.3 beta then you can try this:

    add_filter( 'genesis_attr_entry-image-widget', 'gd_add_custom_class_fp' );
    function gd_add_custom_class_fp( $attr ) {
    $attr['class'] = 'my-own-class';

    return $attr;
    }

    Reply
    • Victor M. Font Jr.

      August 22, 2015 at 12:40 pm

      Thanks for contributing Chinmoy. This code will add the additional class to any entry-image in any type of widget on the page. The OP is asking how to limit the class to featured widget images only. As far as I know, this hook became available in Genesis 2.1.2.

      Reply

Call: +1 919-604-5828

Send us an E-mail

Accessibility Statement | Affiliate Marketing Disclosure | Capability Statement

Cookie Policy | Comment & Product Review Policy | Privacy Policy | Site Map | Terms & Conditions

Copyright © 2003–2023 Victor M. Font Jr.

Return to top of page