Forums

how to edit default widgets in WP 2.2.3? (6 posts)

  1. aux
    Member
    Posted 4 years ago #

    Hey,

    I'm trying to edit one of the default widgets that ships with 2.2.3 - specifically, the "Recent Posts" widgit.

    I'm trying to get it to apply a class to the posts it displays, so I can do some presentation-fu.

    I was able to get it working with some third-party "Recent Posts" widgits, just by sticking in a<div class="recentpost"> before the <a href= in the output module, but the third-party widgits had some other problems that borked things, so I'm now once again trying to get this to work with the default widgit.

    Does anyone know in which file these widgits live? I can't seem to find them. I can probably edit the php myself to apply a class, if I can track the widgits down.

    Thanks!

  2. minus19
    Member
    Posted 4 years ago #

    I'm looking for them myself. I usually just rebuild them but i'd rather use the WP interface.

    You might be able to do what you need in functions.php take a look ;)

  3. Adam Brown
    Member
    Posted 4 years ago #

    On my blog, that widget gets wrapped in both an ID and a class, which should provide all you need for some CSS hackery.

    id="recent-posts" class="widget widget_recent_entries"

  4. minus19
    Member
    Posted 4 years ago #

    I want to add more features though, not style them. I'm working on a CMS back end with WP. A bit like CSSRemix, but with a few bits of usefull AJAX.

    I need to add a date to most recent comments etc.

    That should help out the OP though.

  5. Adam Brown
    Member
    Posted 4 years ago #

    Rather than modify the core, I recommend creating a new widget (based on the default one) and putting it into your functions.php.

    The core file you want is wp-include/widgets.php.

    Read more about creating widgets:

    http://automattic.com/code/widgets/

  6. minus19
    Member
    Posted 4 years ago #

    Cheers, I had some default ones i'd made myself after reading through the Codex, they get a bit messy as 'raw; PHP in my sidebar though. Thanks for that link though, thats just what I needed, now I can keep it all nice and tidy. :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags