Display css ONLY on most recent post of specific category?

0 Votes
    1376 Views

The below is just a scenario to provide context so you understand what im trying to accomplish, However please keep your answers related to the title if possible and a css solution/function.

I have a podcast site that im working on. And i have “next” and “prev” buttons on the podcast post pages that take the user in order to the next podcast episode by date and these buttons only display for the podcast post category.

(so just regular wordpress blog posts in a category called “podcast”)

My issue is the most recent podcast post (for example podcast Ep# 150) would display a “next” episode button. – Being that Ep#150 is the newest podcast post there should be no “Next” button displayed. Right now its taking you to “Ep# 1” when you press it which makes sense, but i would rather not direct users to older episodes on our newest posts.

So i just want to “display:none;” that button on the most recent post in the podcast category.

Thanks for any help!

<span class="prev-ep-wrap">
  <span class="prev-ep">
   <?php next_post_link_plus( array( 'order_by' => 'post_date', 'loop' => true, 'tooltip' => 'Previous Episode', 'in_same_cat' => true, 'ex_cats' => '30, 11', 'link' => 'Previous Episode' ) );?>
  </span>
</span>
<span class="next-ep-wrap">
  <span class="next-ep">
   <?php previous_post_link_plus( array( 'order_by' => 'post_date', 'loop' => true, 'tooltip' => 'Next Episode', 'in_same_cat' => true, 'ex_cats' => '30, 11', 'link' => 'Next Episode' ) );?>
  </span>
</span>

2

Answers


Please signup or login to answer this question.