• Resolved gtk_

    (@gtk_)


    Widget cannot be used in different sidebars, for example
    if we have two sidebars, it can be used only once.

    I am trying to fix this myself, could be usefull to others too.
    Cheers.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thanks. I’m not sure why this is, either, and would love to know if you work it out.

    Thread Starter gtk_

    (@gtk_)

    To fix this remove completely function widget_yarpp_init()
    from includes.php, also the line add_action(‘plugins_loaded’, ‘widget_yarpp_init’); from yarpp.php

    Instead of widget_yarpp_init() place this code, and the plugin will be
    working with multiple sidebars:

    class YarppWidget extends WP_Widget {
        /** constructor */
        function YarppWidget() {
            parent::WP_Widget(false, $name = 'YARPP Widget');
        }
    
        /** @see WP_Widget::widget */
        function widget($args, $instance) {
     		extract($args);
    		global $wpdb, $post;
    		if (is_single() && have_posts()) {
    		  get_post($post->ID);
    		  echo $before_widget;
    		  echo $before_title . __('Related Posts','yarpp') . $after_title;
    		  echo yarpp_related(array('post'),array());
    		  echo $after_widget;
     		}
         }
    
        /** @see WP_Widget::update */
        function update($new_instance, $old_instance) {
            return $new_instance;
        }
    
        /** @see WP_Widget::form */
        function form($instance) {
            $title = esc_attr($instance['title']);
         }
    
    } // class YarppWidget
    
    add_action('widgets_init', create_function('', 'return register_widget("YarppWidget");'));

    Regards,
    George

    Not sure where to leave this but it might as well be here.

    When I first installed YARRP way back. it screwed a lot of things up even though when it worked, it worked the best. But I had to take out of service.

    Then this new version came along so I installed it on two sites and had to take it down as it stopped all the posts and pages from being displayed.

    Sidebar, worked fine.

    Bill

    Thread Starter gtk_

    (@gtk_)

    I suggest you create .htaccess file if you don’t have already one
    on your server root and place on the first line:

    php_flag display_errors on

    Tell us what error shows and will tell you how to fix it ??

    George

    Yes, I have .htaccess installed, I’ll try it and let you know.

    Thanks

    Bill

    @gtk_, what’s the salient difference in that patch you’ve supplied? What makes that work with multiple, but not the supplied code?

    Ok, I’ve installed it in .htaccess, now what?

    B

    @creative-i are you seeing any PHP errors being printed now?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: Yet Another Related Posts Plugin] Widget cannot be used in different sidebars’ is closed to new replies.