Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • I find the solution.

    Change this:

    function add_voting_handler($atts, $content = null)
    {
     global $post;
     $pattern = '#(<a.[^>]*?>)?<img[^>]*src="([^"]*)"[^>/]*?/>(?(1)\s*</a>)#isU';
     //Process nested content first
     $content = do_shortcode($content);
     $content = preg_replace_callback($pattern, "get_image_votes", $content);
    
     return $content;
    
    }
    add_shortcode('add_voting', 'add_voting_handler' );

    Into this:

    function add_voting_handler($content)
    {
     global $post;
     $pattern  = '#(<a.[^>]*?>)?<img[^>]*src="([^"]*)"[^>/]*?/>(?(1)\s*</a>)#isU';
     $content = preg_replace_callback($pattern, "get_image_votes", $content);
     return $content;
    }
    add_filter('the_content','add_voting_handler',10,4);

    It works perfect for me.

    Now, all images in your posts will have the voting system, without using shortcodes.

    jfmitchell

    How can i use this plugin, for all my uploaded images, without shortcode [add_vote][/add_vote]?
    What line of code need to edit?

    Thanks, and sorry for my english ??

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