• Resolved aa430

    (@aa430)


    Hello!

    First off, this is a great plugin. I had success by following the installation page and adding code at the end of functions.php. However, I do not want the thumbs to show up on my pages, only my posts. The Installation page says I can do this by adding a snippet of code “wherever you want it to show”. I want it to show on the Fresh Ideas portion of my website WhatsUpValpo.com. My question is where exactly do I put this code snippet?

    <?=function_exists(‘thumbs_rating_getlink’) ? thumbs_rating_getlink() : ”?>

    I’m learning, and I really appreciate all the help!

    http://ww.wp.xz.cn/plugins/thumbs-rating/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Ricard Torres

    (@quicoto)

    Hello aa430,

    If you want the Thumbs only to show in certain parts of your theme you should remove the snippet from the functions.php.

    Then paste the snippet in your single.php or any other place (php file) you need:

    <?=function_exists('thumbs_rating_getlink') ? thumbs_rating_getlink() : ''?>

    This can be hard if you don’t know your way around a WordPress themes.

    Alternatively you could add a condition to the functions.php snippet. Such as:

    function thumbs_rating_print($content)
    {
    	$return = $content;
    
    	if( !is_page() ){
    		$return .= thumbs_rating_getlink();
    	}
    
    	return $return;
    }
    add_filter('the_content', 'thumbs_rating_print');

    This will print the Thumbs Rating everywhere but Pages.

    Hope this helps.

    Cheers.

    Ps: if you need to tweak the condition, here’s the Conditional Tags codex page http://codex.ww.wp.xz.cn/Conditional_Tags

    Thread Starter aa430

    (@aa430)

    Thank you very much!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Where do I add code snippet on posts only?’ is closed to new replies.