Support » Fixing WordPress » Excluding a plugin from a certain page

  • Hi,

    I added a little ajax like – dislike plugin to my site and it’s working nicely. The problem is, i want the like – dislike to be shown only on posts, not on every page, like here: http://whatdidyoudo.org/?page_id=2

    I can’t use Widget Logic plugin, cause the ajax widget isn’t in the sidebar. Is there a php or css code that I can add to page.php or somewhere so it would exclude the widget from certain pages?

    Thanks

Viewing 9 replies - 1 through 9 (of 9 total)
  • If you have a single.php file, WP will use that to display posts. So you could add the code there. Stepping into templates

    Moderator Mark Ratledge

    (@songdogtech)

    Forum Moderator

    Try deeactivating the plugin to keep it from loading all the time, and then using this in header.php to show the like/dislike only on home:

    <?php } if (is_page('home')) { ?><script type='text/javascript' src='http://whatdidyoudo.org//wp-content/plugins/visitor-likedislike-post-rating/js/jquery-1.3.2.min.js?ver=1.3.2'></script><?php } ?>

    jQuery should load OK for the rest of the scripts in your theme, but try it.

    You also seem to have a trailing slash on your site URL in ypur settings, and that is puting a double slash on your include URLs; look in page source to see what I mean.

    Thank you for your reply, I deactivated the plugin and added the code into header.php, but I got this error:

    Parse error: syntax error, unexpected ‘}’ in /home/a8787359/public_html/wp-content/themes/p2/header.php on line 13

    And how can I get rid of the trailing slash?

    Thanks

    Moderator Mark Ratledge

    (@songdogtech)

    Forum Moderator

    Sorry, my mistake on the php; should be:

    <?php if (is_front_page()); ?><script type='text/javascript' src='http://whatdidyoudo.org//wp-content/plugins/visitor-likedislike-post-rating/js/jquery-1.3.2.min.js?ver=1.3.2'></script><?php;?>

    Look in Settings/General to see if you have a trailing slash on your blog URL

    Another error:

    Parse error: syntax error, unexpected T_STRING, expecting ‘(‘ in /home/a8787359/public_html/wp-content/themes/p2/header.php on line 11

    Moderator Mark Ratledge

    (@songdogtech)

    Forum Moderator

    Sorry again. It’s too early in the morning! I corrected the code directly above and tested it again.

    Now it doesn’t give any errors, but it also wont show up the like/dislike links. I have to learn php..

    Moderator Mark Ratledge

    (@songdogtech)

    Forum Moderator

    I don’t see the like/dislike plugin loading in page source; sure that code is in header.php above the </head> tag?

    I use that technique for some plugins, but it also may depend on how that plugin hooks in to WP, too.

    Yes, I took it down for a minute and added it again now, still no change.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Excluding a plugin from a certain page’ is closed to new replies.