Category page with titles only
Like this ?
I installed the nicer archives hack (and yes, that css of mine is appalling !)
Not exactly like that. Where is the nicer archives hack?
Here is an example:
I have two posts in General category and I only want to see the titles of those two posts when I goto the General category page.
The only way I could think of to do it would be to make a modified index.php with only time and title tags (maybe extracts too, depending on how many posts you have) and then setting it to only display one category.
Unfortunately you would only get as many posts listed as you had set for the index page to display, though you might be able to pass a new value for posts per page to override your settings – haven’t tried that yet, but it could work.
you can detect if you are on a category page generally if !empty($cat) — that catches the general-case situations.
Then, where you’d normally output the_content in your index.php file, check cat first. i.e.
<?php if (empty($cat)) the_content(); ?>
Something like that work for you?
works exactly for me, take a look:
It should work with Matt’s “nicer archives” hack. I use a modified version of that, although I don’t remember exactly what I modified.
Matt’s hack is somewhere on the Wiki.
Basically, you do a general check to see if you’re in some kind of archive, then proceed to display content according to what kind of archive it is (i.e. whether based on category or time)
You may also need this for your heading (not sure if it’s in the original hack):
And old thread, but here is my solution anyway
Between David Chait’s category detection post and Prem Rara’s “got it!” post, what transpired?
I’ve been trying to get category archives to display as title lists for several hours, and had no luck whatsoever. I’ve scoured the codex and the support forums, and visited sites of folks that have made it work — no luck yet.
What am I missing?
Sorry about that, moshu. I figured it would be better than starting a fresh topic.
I’d already looked at both of those Codex pages, and didn’t see how they would help — I’ll take another look.
Got it! I kludged in a bit of other code to get them to display alphabetically, and all is well.
Thanks, moshu! 🙂
- The topic ‘Category page with titles only’ is closed to new replies.