WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: WordPress Popular Posts] Tricks for current menu item (1 post)

  1. sardbaba
    Member
    Posted 2 years ago #

    Hello,
    I've done some tricks to make WPP to act like I want; this may be useful for someone with my same problem.

    So, the problem: the function get_mostpopular() returns a string, with
    <ul><li><a> tags; I want to let have a class like "current-menu-item" in order to make it bolder (or what you want to do, that's doesn't matter).

    First of all in function.php create something like this:
    [Code moderated as per the Forum Rules. Please use the pastebin]

    You can customize the function like you want, taking help from the original get_popular_posts() (the one used by get_mostpopular() that returns the string).

    In one of the template files (i've used sidebar) you can invoke our function:
    [Code moderated as per the Forum Rules. Please use the pastebin]

    Naturally this is MY semplification, it will be good if plugin's owners makes this changes as default; I think it's better to return an array to let you play with it as you want.

    Hope to help someone.

    Cheers.

Topic Closed

This topic has been closed to new replies.

About this Topic