Forums

[resolved] Changing variables with a plugin (2 posts)

  1. pajtai
    Member
    Posted 4 weeks ago #

    I'd like to change a widget.

    In the Recent Posts widget ( class WP_Widget_Recent_Posts extends WP_Widget ), only at most 15 of the most recent posts are displayed. I'd like to increase this number.

    The variable in question is $number.... How do I change what this variable is set to? I don't want to hard code it into the class.

    Should I make a personal plugin to change this? Not quite sure where to begin.

    Either an answer or pointing to relevant thread would be appreciated.

    There's a few threads dealing with this issue, but I haven't found one with a solution that doesn't involve changing the code in default-widgets.php.

    Can I just re-write the recent posts widget class in the functions.php of my theme?

    Thanks,
    Peter.

  2. pajtai
    Member
    Posted 2 weeks ago #

    Ok, I got it. I can just make a custom widget. You just have to make sure to initialize and register it.

    I just copy and pasted the code of the original widget into functions.php, changed its name, edited it as desired, initialized, and registered it.

Reply

You must log in to post.

About this Topic