WordPress.org

Forums

Overriding widgets.php (1 post)

  1. Kyle Skrinak
    Member
    Posted 6 years ago #

    Actually this applies to 2.7, but my guess is this is relevant to 2.6, too.

    I wish to override a widgets.php function, namely, the wp_widget_recent_entries function. Why? I'm nesting the actual widget div inside 3 ascending parent divs for rounded corners (of course css comes into play -- but that's not germane), as well as adds a static link to the sidebar.

    <?php /*SCI Mod for Recent Entries Widget; adds curved edge to layout*/ ?>
    <div class="sb-mid"><div class="sb-bottom"><div class="sb-header">
    <?php echo $before_title . $title . $after_title; ?>
    <ul>
    <?php  while ($r->have_posts()) : $r->the_post(); ?>
    <li>&ldquo;<?php if ( get_the_title() ) the_title(); else the_ID(); ?>&rdquo;</li>
    <?php endwhile; ?>
    </ul>
    <p class="f-right"><a href="/dr-robs-blog/">read more</a>
    </div></div></div>

    You can see the resulting code http://drbaric.com in the sidebar.

    I can do so without problems to a wp-includes/widgets.php file but I'm sure there are better other ways to achieve this -- as my current method makes me a rebel, a renegade, an outcast but I want to make upgrading easier than having to run kdiff3 on every subsequent upgrade.

Topic Closed

This topic has been closed to new replies.

About this Topic