Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 210725

How to reference current post in loop for styling?

$
0
0

Replies: 0

Hello! I’m building a simple content loop that includes the page that contains the shortcode. I’d like to add a CSS tag to the current post in the loop so that it has a different background color. Is that possible with this plugin? I’d assume you could reference the current URL and compare with an if statement, something like that. I added it with pseudo-working code below:

[raw]
[loop exists type=post format=false tag=healthcare-exchanges]

<div class=”ccs-loop”>
<span class=”toc-loop-title”>Title here</span>
<h4 class=”toc-loop-subhead”>Information about the important posts that are all talking about how great school integration in the United States is.</h4>
[the-loop]
<div class=”toc-wrapper” [if current=post]tag=”ccs-toc-current-post”[/if]>
<div>[field title-link]</div>
</div>
[/the-loop]
</div>

[/loop]
[/raw]

  • This topic was modified 26 seconds ago by  simongle.

Viewing all articles
Browse latest Browse all 210725

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>