Skip Navigation

[Resolved] A conditional statement is impacting style

This support ticket is created 7 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 4 replies, has 2 voices.

Last updated by Daniella 7 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#562981

I would like to style a categories that are not in the Custom Post Type of "Alerts" differently.

Link to a page where the issue can be seen: hidden link

The first title is an Alert. The next two are Posts.

I am using the following Content Template:
[wpv-conditional if="( '[wpv-post-type]' eq 'alert' )" evaluate="true"]<div class="alert"><h2 class="entry-title">[wpv-post-link]</h2><br /><span class="entry-meta">Filed under: [wpv-post-taxonomy type="category" separator=", " format="link" show="name" order="asc"]</span></div>[/wpv-conditional]

<div class="notalert">[wpv-conditional if="( '[wpv-post-type]' eq 'alert' )" evaluate="false"]
<h2 class="entry-title">[wpv-post-link]</h2><br />
<div class="one-third first">[wpv-post-featured-image size="custom" width="250" height="150"]</div><div class="two-thirds">[wpv-post-excerpt]<span class="entry-meta">Filed under: [wpv-post-taxonomy type="category" separator=", " format="link" show="name" order="asc"]</span></div>[/wpv-conditional]</div>

When I try to style the 'notalert' class, only the h2 becomes styled or the two Posts are styled together and not as separate entities. Not sure of the best way to accomplish this.

Thanks!

#563019

Dear Daniella,

I think you will need to wrap the entire HTML DIV tag <div class="notalert">...</div> into the [wpv-conditional] shortcode, for example:

[wpv-conditional if="( '[wpv-post-type]' eq 'alert' )" evaluate="true"]
<div class="alert">
<h2 class="entry-title">[wpv-post-link]</h2><br />
<span class="entry-meta">Filed under: [wpv-post-taxonomy type="category" separator=", " format="link" show="name" order="asc"]</span>
</div>
[/wpv-conditional]
[wpv-conditional if="( '[wpv-post-type]' eq 'alert' )" evaluate="false"]
<div class="notalert">
<h2 class="entry-title">[wpv-post-link]</h2><br />
<div class="one-third first">[wpv-post-featured-image size="custom" width="250" height="150"]</div>
<div class="two-thirds">[wpv-post-excerpt]<span class="entry-meta">Filed under: [wpv-post-taxonomy type="category" separator=", " format="link" show="name" order="asc"]</span></div>
</div>
[/wpv-conditional]
#563200

I've tried that as well and it still doesn't work. The 'notalert' class is only affecting the <h2>. Thanks for your help. Any other ideas?

#563218

It is a CSS problem, you can try below CSS codes:

div.notalert {
    background-color: blue;
    float: left;
}
#563298

Thanks!