WordPress.org

Ready to get started?Download WordPress

Forums

Show in Sidebar (2 posts)

  1. tyok
    Member
    Posted 6 years ago #

    Hi, could you add a feature so we could choose to show the related posts in sidebar-as a widget-instead of below the post?

    I've managed to achieve that by manually editing yarpp.php:
    1. I commented this line:
    add_filter('the_content','yarpp_default');
    2. Then I added this:

    function widget_yarpp_init() {
    
    	if ( !function_exists('register_sidebar_widget') || !function_exists('register_widget_control') )
    
    		return;
    
    	function widget_yarpp($args) {
    		extract($args);
    		global $wpdb, $post, $user_level;
    		if (get_option('yarpp_auto_display') and is_single()) {
    				echo $before_widget;
    				    	echo $before_title . 'Recent Posts' . $after_title;
    					echo yarpp_related(array('post'),array());
    				echo $after_widget;
    		}
    	}
    	register_sidebar_widget(__('YARPP'), 'widget_yarpp');
    }
    add_action('plugins_loaded', 'widget_yarpp_init');

    But it'd be nice if there is an option for that in the admin panel.

    Sorry if I ask too much, and thanks for this splendid plugin!

  2. @tyok — Thanks for the suggestion! I'll make sure to put widget-ization in 2.0... do you mind if I use your code as its base, with due credit? Email me and let me know.

    Thanks again,
    mitcho

Topic Closed

This topic has been closed to new replies.

About this Topic