• 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 9 years, 8 months ago by simongle.
Viewing 1 replies (of 1 total)
  • Hi,

    Do you already have a solution? If not, will you try this code?

    [pass field=id]
    [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 field=id value={FIELD}]tag="ccs-toc-current-post"[/if]>
    <div>[field title-link]</div>
    </div>
    [/the-loop]
    </div>
    
    [/loop]
    [/raw]
    [/pass]

    Peter

Viewing 1 replies (of 1 total)

The topic ‘How to reference current post in loop for styling?’ is closed to new replies.