• This plugin is simple and does what it’s supposed to do. However, I’m trying to figure out how to get more control over where the plugin is displayed. It shows up on pages as well as posts, which I don’t need. I also don’t want it to show up on certain posts (sticky posts and posts in the “news” category). I’ve been looking through the code to see if there’s somewhere I can insert a conditional to make this happen, but (as a newcomer to php) my experiments have so far been unfruitful.

    Any suggestions would be greatly appreciated.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter jssssperr

    (@jssssperr)

    I’m still stumped. This plugin doesn’t require me to insert any tags into the theme, so I can’t simply throw a conditional around something like that.

    At the end of the plugin code, there’s this:

    $PostRating = new PostRating();
    add_action('wp_head', array(&$PostRating, 'Initialization'));
    add_action('plugins_loaded', array(&$PostRating, 'LoadExtensions'));
    add_action('the_content', array(&$PostRating, 'RatingLinks'));
    add_action('wp_footer', array(&$PostRating, 'VisitorCredits'));

    which I assume is what actually loads the voting links onto the posts/pages. I tried wrapping that in a conditional like this:

    if (!is_page() || !is_sticky()){
    $PostRating = new PostRating();
    add_action('wp_head', array(&$PostRating, 'Initialization'));
    add_action('plugins_loaded', array(&$PostRating, 'LoadExtensions'));
    add_action('the_content', array(&$PostRating, 'RatingLinks'));
    add_action('wp_footer', array(&$PostRating, 'VisitorCredits'));
    }

    The revised plugin saved fine, but my website displayed no visible change. I then tried wrapping the entirety of the plugin (the entire php tag) in the same condition, and still nothing changed. Any ideas?

    Thread Starter jssssperr

    (@jssssperr)

    Just now, I also tried adding the condition to the individual functions (Initialization, LoadExtensions, RatingLinks, and VisitorCredits). Same thing, no change. :/

    I like the plugin but it disabled my tinymce editor. Whichever tab was active when activated (Visual|HTML) is the tab it gets stuck on.

    It happened with 2.8 and 2.8.2. Strange!

    bump, i have the same question?

    disabled my tinymce editor. problem solved
    Replace this code to in visitor-likedislike-post-rating.php

    function LoadExtensions() {
    
    		$plugin_JS_path = get_option('siteurl').'/wp-content/plugins/visitor-likedislike-post-rating/js/';
    		wp_deregister_script('jquery');
    		wp_enqueue_script('jquery', $plugin_JS_path.'jquery-1.3.2.min.js', FALSE, '1.3.2');
    }
    	}

    ADD This code>>>>>

    function LoadExtensions() {
    	 if(!is_admin())
    	 {
    		$plugin_JS_path = get_option('siteurl').'/wp-content/plugins/visitor-likedislike-post-rating/js/';
    		wp_deregister_script('jquery');
    		wp_enqueue_script('jquery', $plugin_JS_path.'jquery-1.3.2.min.js', FALSE, '1.3.2');
    	}
    	}

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Visitor Like/Dislike Post Rating] Disable plugin on pages and certain posts’ is closed to new replies.