Well I gave up on these two after several hours of attempts.
I am trying to return true if the post being displayed is in a specific category and only that category.
Also create a "dynamic" link to the latest post if it is in a specific category and only that category.
Basically, I have navigation graphics on my site.
Two of the graphics are (temporarily) hard coded links in the header template file that each link to their specific post.
1- I would like a link to go to the latest post in a specific category.(Must be only one category assigned to it and cat must exist)
I know there is a way to click on a category and get/view the latest post in that category.
Thing is, I want some sterilization/filters so:
- If the post belongs to more than one category, it (result) is not included.
- Must be assigned to the one specific category only!
- Would like the link only to appear if there is a post in that category!
2- I desire to change the links style when they are are clicked on (active). Hence, how do I detect if the post is being viewed is an a specific category and only that category.
I tried several things including using post in pages but, I want all the features and control of a post like selecting how may per page and all the other core functs...
No plugins but, all in the template and/or template functions.
(And world peace)
I was attempting:
<?php query_posts('category_name=Wordpress&post_status=publish,future');?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); $activestyle="some_style"; ?>
So: (if viewing a post in category WordPress (and only that category))
<li class="<?php $activestyle ?>">WordPress
I realize I need some elses for sterilization but aaahhh! Help!
I came close a couple times but, ultimately failed. I know this will be useful to others when I get it all nailed down. With everyones help here...
Thanks in advance..