Support » Plugin: WP TripAdvisor Review Slider » “More” button (to show full review)

  • Resolved nikkoboy

    (@nikkoboy)


    I noticed that my reviews now appear in their entirety (not anymore a preview with the “More” link/button). Instead of showing the first paragraph, the review appears entirely, which in some case takes a lot of vertical space! Is this a change in TripAdvisor’s API or a bug linked to your plugin?

    Thanks for any help you can provide

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author jgwhite33

    (@jgwhite33)

    I wouldn’t call it a bug. If the plugin can grab the entire review it does, if it can’t then it tries to grab what it can. In the past, this was up to the read more tag. TripAdvisor changed the way they use the read more on their site, so now the plugin can grab the entire review. You could try changing your slider setting to 1 review per a slide, that should make the height a lot smaller. The Pro version allows you to set a read more after so many words or characters. If you want to modify the free version I can tell you what you need to change to add a read more link.

    Thread Starter nikkoboy

    (@nikkoboy)

    @jgwhite33 thanks for the feedback, this is much appreciated! Yes, I thought TripAdvisor would be behind this unexpected change in the plugin’s behavior, since it worked flawlessly until recently.

    I’d be more than happy to know what I need to change in the code in order to modify the free version to add a “read more” link! Thanks a lot for the offer!

    Plugin Author jgwhite33

    (@jgwhite33)

    Luckily it looks like I started to add this code in the past some time and didn’t finish it.

    In this file…

    \public\partials\template_style_1.php

    on line 75 add these two lines…

    $currentform[0]->read_more = 'yes';
    $currentform[0]->read_more_num = 20; //number of words before
    Thread Starter nikkoboy

    (@nikkoboy)

    @jgwhite33 thanks for sharing this code snippet! I tried and implemented it, but is somehow broke the page where your plugin’s shortcode is embedded.
    Could you confirm how I need to edit this:

    		//if read more is turned on then divide then add read more span links
    		if(	$currentform[0]->read_more=="yes"){
    			$readmorenum = intval($currentform[0]->read_more_num);
    			$countwords = str_word_count($reviewtext);

    I’ll try and do the same via ftp.

    Thanks anyway!

    • This reply was modified 1 year, 7 months ago by nikkoboy.
    Thread Starter nikkoboy

    (@nikkoboy)

    Okay, I found where the problem was: there was one “=” too many.

    This seems to be the “right” code:

            if($currentform[0]->read_more ="yes"){
                $readmorenum = ($currentform[0]->read_more_num = 20);
                $countwords = str_word_count($reviewtext);

    Thanks for the help!

    Plugin Author jgwhite33

    (@jgwhite33)

    That if statement is supposed to have 2 = , but it would work with one. When you change it to 1 = it is actually setting it to =. Here is what the entire code snippet should be…

    		//if read more is turned on then divide then add read more span links
    		$currentform[0]->read_more = 'yes';
    		$currentform[0]->read_more_num = 20; //number of words before
    		if(	$currentform[0]->read_more=="yes"){
    			$readmorenum = intval($currentform[0]->read_more_num);
    			$countwords = str_word_count($reviewtext);
    			
    			if($countwords>$readmorenum){
    				//split in to array
    				$pieces = explode(" ", $reviewtext);
    				//slice the array in to two
    				$part1 = array_slice($pieces, 0, $readmorenum);
    				$part2 = array_slice($pieces, $readmorenum);
    				$reviewtext = implode(" ",$part1)."<a class='wprs_rd_more'>... read more</a><span class='wprs_rd_more_text' style='display:none;'> ".implode(" ",$part2)."</span>";
    			}
    		}
    Thread Starter nikkoboy

    (@nikkoboy)

    Ok, I got it, thanks! I’ve implemented your code instead and it works smoothly. I just had to replace $currentform[0]->read_more = 'yes'; by $currentform[0]->read_more = "yes"as the Read More was not clickable.

    Out of curiosity, is there a snippet of code to collapse the content back to what it was? Something like “Read Less”

    • This reply was modified 1 year, 7 months ago by nikkoboy.
    Plugin Author jgwhite33

    (@jgwhite33)

    Sorry, there isn’t ‘read less’ code I can easily share. It would require some additional javascript.

    If you’re interested the Pro version has ‘read less’.

    Thanks,
    Josh

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘“More” button (to show full review)’ is closed to new replies.