Modify the post/entry wrapper markup in genesis childtheme [closed]

I feel like this should be an easily found answer but so far I havent found anything.

So the genesis loop automatically wraps the posts in a div like so:

    <div class="post-4006 post type-post status-publish 
format-standard hentry category-blog tag-foia tag-nmb entry">...</div>

Well I need to change that markup to add a background image to each post. Im trying to take the featured image and apply it to the div background, so I would need my posts mark

    <div style="url_to_post_thumbnail" class="post-4006 post type-post status-publish 
format-standard hentry category-blog tag-foia tag-nmb entry">...</div>

I can do the logic just fine but I dont know what filter to modify the post wrapper. and I cant seem to find it.

2 Answers
2

Today I had a similar issue and this worked for me:

/**
 * Add and extra class to the entry-content div
 *
 */
function vdl_entry_content_extraclass( $attributes ) {
  $attributes['class'] = $attributes['class']. ' my-custom-class';
    return $attributes;
}
add_filter( 'genesis_attr_entry-content', 'vdl_entry_content_extraclass' );

In my case, I am adding this code to my single-portfolio.php template because I only want to add that class in that template. If you paste this code in functions.php the change will apply all templates. You could also use conditional tags inside the function to decide where to apply this change.

As I only started this week with Genesis, and this is my first child theme, I don´t know if this is the right way to do it, but I hope it will help you.

Leave a Comment