Wildcard Selectors; Public domain image from pixabay.com

AddClass to Genesis Featured Post Image

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:

https://gist.github.com/vfontjr/988b672bcac2b633c0dc8fdb20dbab8c#file-genesis_page_header_script-js

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/