• Great plugin but I only wanted to use it very selectively on certain posts and pages. So rather than edit the template files in my theme, I added some code to my theme functions.php which allows the use of [likethis] as a shortcode:

    function register_shortcodes() {
    
    	add_shortcode("likethis", "likethis_shortcode");
    
    }
    
    function likethis_shortcode() {
    
    	if(function_exists('printLikes')){
    		ob_start();
    		printLikes(get_the_ID());
    		return ob_get_clean();
    	}
    
    }
    
    add_action( 'init', 'register_shortcodes');

    Hope that proves useful to someone – and would love to see it in the plugin itself.

    http://wordpress.org/plugins/roses-like-this/

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

    (@rosemariep)

    Nice, thanks for posting!

    Next time I release an update I’ll definitely try to include this (with due credit of course)

    i cant see button i my site. i add this code to functions and the shortcode you say at your website to my page.php.
    but does’nt work yet

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding a shortcode’ is closed to new replies.