WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Tweak the wp_get_archives() output (2 posts)

  1. acub
    Member
    Posted 5 years ago #

    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.

    Thank you.

    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).

  2. acub
    Member
    Posted 5 years ago #

    I'd like this deleted. I've made some error and was not able to edit it. So I've posted it a second time, without the error.

    Thank you and sorry for the inconvenience.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.