WordPress.org

Forums

Help with making a change in widget.php (7 posts)

  1. travelbug2007
    Member
    Posted 7 years ago #

    Hello,

    I have posted my widget.php below. Can someone please tell me what I need to modify to change the number of recent posts that show up in my sidebar. I see the widget icon for recent posts in the Design area, but it does not allow editing like the other widgets when you click on it.

    Currently I have 5 posts that are showing in the sidebar. I read a post that said to go to an area of code that said something like wp_widget_recent_entries and look for else if ( $number > 15 )
    $number = 15;

    I am confused about what to change, since I don't have 15 posts showing. I did see the number 5 in a few spots near the same area, but I am not sure if that is what I need to be changing.

    Any help would be appreciated,
    Thank you

    [code moderated - please post in a pastebin and report the link back here]

  2. travelbug2007
    Member
    Posted 7 years ago #

    http://wordpress.pastebin.ca/1006501

    Here is the pastebin for my widget.php

    Thank you

    My site is http://www.parnellpainting.com

    and the theme is Floralia

    Thank you

  3. adam-s
    Member
    Posted 7 years ago #

    Assuming your at WordPress 2.5+ and using the recent posts widget...

    Go to design->widgets and check the Recent Posts widget for an edit link...very small. You should be able to use the fields that pop up to modify the recent posts number.

    I believe the file you posted is for widgets in general and not the recent posts widget specifically.

  4. travelbug2007
    Member
    Posted 7 years ago #

    Hi,

    I just put wordpress in the other day through Fantastico, I am not sure which version I have, whatever it gave me. I see it is telling me to update to version 2.5.1 so I assume I have the version prior to that.

    I see the icon for the widget that is in the sidebar, but unlike the other widgets, it does not have that tiny edit work that you can click on and make changes to, not sure why?

    So I assume I do need to change it in the widget.php?

    Thank you

  5. adam-s
    Member
    Posted 7 years ago #

    On older versions there should be a small icon to the left of the widget line in Presentation->widgets. Clicking this should bring up the menu.

    Note that you have to save the widget to the sidebar before this appears though. I've seen some very outdated software installed by Fantastico. If your wordpress version is older than this I would just go with an upgrade.

    If this doesn't work and you're determined to modify core files (I doubt this is ever needed and I wouldn't consider it a good idea <-disclaimer)...

    Find the below line in widgets.php...

    $r = new WP_Query("showposts=$number&what_to_show=posts&nopaging=0");

    Change to...
    $number=15;
    $r = new WP_Query("showposts=$number&what_to_show=posts&nopaging=0");

    Keep in mind I want to go on record as having given a disclaimer in hope that I won't be yelled at for giving bad advice.

  6. travelbug2007
    Member
    Posted 7 years ago #

    Hello again,

    Sorry to have to keep dragging this post on, but I am just not having any luck with this. To the best of my knowledge I have wordpress 2.5 if that is such a version. There is no version listed at the bottom of any of the pages when I log in. It only says Thank you for creating with WordPress Get version 2.5.1

    Something is really strange with this Recent Post Widget that is in my sidebar. At one point I would have put some writing in for it because it says Recent Posts:Painting Information in the box. It is in the spot where the rest of the plugins have been dragged over that are currently in my sidebar, but it just does not have any option to do anything to it. The other plugins have a litte word edit right on the box that you can click on and then make changes, remove it, etc. The way this plugin is right now, I can't even remove it. I am not even sure how it got there at this point.

    My theme I am using and website are up top in one of my above posts if that will help to look at.

    I will not go ahead and try to change the core files at this point as the last post warns against. I am a newbie and will trust the advice of someone with more knowledge.

    Don't know what to do at this point, any suggestions please.
    Thank you

  7. adam-s
    Member
    Posted 7 years ago #

    Very strange. Hopefully someone smarter than me has input on this. I hesitate to make another guess.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.