• Nick,

    I am trying to style the post tile to have a wrap around effect with transparency as can be seen at http://3dtest.breitenbucher.net/ Currently the styling only works if there is an image displayed. What I’d like to do is conditionally add a class to the title based on whether an image is being displayed or not. I am currently adding the class by adding some actions to gfwa_before_post_content. Is there a way to add a different class depending on if an image is actually present? Something like if(has_post_thumbnail() && for this instance of the widget we are showing post_thumbnails) then add an action to gfwa_before_post_content with one class and otherwise add an action with a different class.

    I know I need to fix the structure so that only the background image has opacity and not the text.

    Thanks.

    http://wordpress.org/extend/plugins/genesis-featured-widget-amplified/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Nick the Geek

    (@nick_thegeek)

    you would need to use the post_class filter and add your class using the conditional tag. Here is the Codex article on using post_class() and specifically adding to the classes with filters
    http://codex.wordpress.org/Function_Reference/post_class#Add_Classes_By_Filters

    Thread Starter Jon Breitenbucher

    (@kahless)

    Thanks Nick.

    I’m not sure which conditional tag you mean. What I haven’t been able to determine is if it is possible to do something like

    if(has_post_thumbnail() && for this instance of the widget we are showing post_thumbnails)

    I think just checking for has_post_thumbnail() won’t work because the widget may not be set to display the thumbnail.

    As you probably noticed the CSS for the div containing the title has a top: -136px to compensate for the presence of the image. If someone chooses not to display the image then this pulls the div too far up.

    If it isn’t possible to test whether there is a thumbnail and the instance of the widget is showing it then I’ll need to rethink how I’m doing things.

    Thanks.

    Plugin Author Nick the Geek

    (@nick_thegeek)

    I don’t know about checking for the instance, but you should be able to apply your CSS based on the location and if it has an image. The post class filter can add the image code conditionally with has_post_thumbnail(). I don’t have any way to pass the $instace value into that filter though.

    Thread Starter Jon Breitenbucher

    (@kahless)

    Thanks Nick.

    So there really isn’t a way to accomplish what I’m after.

    I’m pretty sure doing a check for has_post_thumbnail() won’t accomplish the job since it can’t handle the fact that a user may have chosen not to show the thumbnails in a particular widget area, and since there are multiple widget areas, I can’t really use a class of a particular area.

    I may be stumped.

    Plugin Author Nick the Geek

    (@nick_thegeek)

    It could probably be done but it might be very complex I’m not sure that doing it with this widget as it is will be the ideal solution. I am looking at adding the instance field as a post class in addition to simply adding it as a value that can be tested against within $instance. That won’t be until the next version which I am planning for Genesis 1.9 release

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Genesis Featured Widget Amplified] Different action for gfwa_before_post_content based on p’ is closed to new replies.