Skip Navigation

[Résolu] A conditional statement is impacting style

This support ticket is created Il y a 6 années et 8 mois. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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 réponses, has 2 voix.

Last updated by Daniella Il y a 6 années et 8 mois.

Assisted by: Luo Yang.

Auteur
Publications
#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!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.