Support » Plugin: Animated Rotating Words (Random Words in a Sentence) » Bugfix for transition from last word to first word

  • ulrich.schmidt

    (@ulrichschmidt)


    I fixed the issue that there was a break were no word is shown between the last and the first word.

    The bug was caused because you splitted the words and joined them again and there was a comma after the last word.

    Remove $rotate_words_arr, just pass the comma seperacted word string directly to the html output.

    Here is the fixed code. Just replace that function in the plugin.class.php with this code.

    	function render_words_rotator($atts, $content, $the_shortcode){
    		$savedmeta = get_option( 'la_words_rotator' );
    		if (isset($savedmeta['rotwords'])) {
    			foreach ($savedmeta['rotwords'] as $key => $data) {
    				if ($atts['id']== $data['counter']) {
    					wp_enqueue_script( 'modernize-js', plugins_url( 'js/jquery.simple-text-rotator.min.js', __FILE__ ),array('jquery'));
    					wp_enqueue_script( 'script-js', plugins_url( 'js/script.js', __FILE__ ),array('jquery'));
    					wp_enqueue_style( 'modernize-cs', plugins_url( 'js/simpletextrotator.css', __FILE__ ));
    					wp_localize_script( 'script-js', 'words', array(
    										'animation' => $data["animation_effect"],
    										'speed' => $data['animation_speed'],
    										
    									));
    
    					$rotate_words = $data['rot_words'];
    					// print_r($rotate_words_arr);
    					$postContents.='<h1 class="demo" style="font-size:'.$data['font_size'].'px;color:'.$data['font_color'].';">';  
    					$postContents.=$data["stat_sent"] ;  
    					$postContents.=' <span class="rotate" style="font-size:'.$data['font_size'].'px;color:'.$data['words_color'].';">';  
    						
    					// Fixed By Ulrich Schmidt (of velian GmbH):
    					$postContents .= $rotate_words;
    															
    					$postContents.='</span>' .$data['end_sent'].'</h1>'; 
    					return $postContents;
    
    				}	
    			}
    		}
    	}
  • The topic ‘Bugfix for transition from last word to first word’ is closed to new replies.