[Resolved] Tweak the wp_get_archives() output
Here’s what i want to do. Actually I already did it, but I was wondering if it can be done better.
I wanted to tweak the output of wp_get_archives() so that all the posts from a category would display the name of that category in front of their names, so they stand out in the list and can be easily noticed/ignored. The posts in that category are not real content. They are how-tos and even though i want them in the lists I want people to know they are apart from the rest of the posts.
What I did was: created a function that checks if a particular post is in a particular category and I’ve put a hook in the ‘postbypost’ case of wp_get_archives(). If the post is in the category, the category name is written in <code style=”display: inline;”>$before just before the get_archives_link() function.
My question: could this be done without changing the general-template.php so the change would still stand in wp-upgrades?
If i make a modified copy of general-template.php and place it in my theme’s folder, will it be read instead of the one in wp-includes? Do I need to declare it somewhere?
Just trying to learn here, so my tweaks become cleaner.
Oh, and the working example of the tweak is on http://lithera.ro (You have to hover on the “t” in the interactive menu on the right to display the modified list).
- The topic ‘[Resolved] Tweak the wp_get_archives() output’ is closed to new replies.