• 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 https://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.

  • The topic ‘Overriding widgets.php’ is closed to new replies.