WordPress.org

Ready to get started?Download WordPress

Forums

WP-Cirrus
WP-Cirrus Output Before Text (2 posts)

  1. toppy
    Member
    Posted 1 year ago #

    When I tried to use WP-Cirrus in a post I noticed that it would always display before any text in a post. This happens when the plugin echos content instead of returning it. A fix for this is:

    ~Line 34: add a return in wpcirrusShortCodeHandler:

    function wpcirrusShortCodeHandler($atts=NULL){
    	return wpcirrusInit(true, $atts);
    }

    ~Line 342 (function: wpcirrusInit): Add an ob_start(); around line 342 before Javascript output and then add a return ob_get_clean(); around line 373 function after the div:

    ob_start();
    	?>
    	<script type="text/javascript">
    		var wpcirrusRadius<?php echo $tagBoxName?> = <?php echo $options['radius'];?>;
    		var wpcirrusRefreshrate<?php echo $tagBoxName?> = <?php echo $options['refreshrate'];?>;
    		<?php
    		if(!empty($options['fontcolor'])){
    			echo "var wpcirrusFontColor".$tagBoxName." = '" . $options['fontcolor'] . "';";
    		} else {
    			echo "var wpcirrusFontColor".$tagBoxName.";";
    		}
    		if(!empty($options['backgroundcolor'])){
    			echo "var wpcirrusBackgroundColor".$tagBoxName." = '" . $options['backgroundcolor'] . "';";
    		} else {
    			echo "var wpcirrusBackgroundColor".$tagBoxName.";";
    		}
    		?>
    	</script>
    	<div style="position: relative; height: <?php echo $options['height'];?>px; width: <?php echo $options['width'];?>px;"  id="<?php echo $tagBoxName?>">
    		<?php
    		 if($options['mode'] == 'both'){
    			echo wp_tag_cloud($options['args'] = $options['args'] . "&taxonomy=post_tag&number=" . $options['number'] . "&orderby=" . $options['orderBy'] . "&order=" . $options['sortOrder'] . "&smallest=" . $options['smallest']  . "&largest=" . $options['biggest']);
    			echo " " . wp_tag_cloud($options['args'] = $options['args'] . "&taxonomy=category&number=" . $options['number'] . "&orderby=" . $options['orderBy'] . "&order=" . $options['sortOrder'] . "&smallest=" . $options['smallest']  . "&largest=" . $options['biggest']);
    		} else if($options['mode'] == 'pages'){
    			echo wp_list_pages("echo=0&title_li=");
    		} else {
    			echo wp_tag_cloud($options['args'] = $options['args'] . "&taxonomy=". $options['mode'] ."&number=" . $options['number'] . "&orderby=" . $options['orderBy'] . "&order=" . $options['sortOrder'] . "&smallest=" . $options['smallest']  . "&largest=" . $options['biggest']);
    		}
    		?>
    	</div>
    	<?php
    	return ob_get_clean();

    http://wordpress.org/extend/plugins/wp-cirrus/

  2. toppy
    Member
    Posted 1 year ago #

    Note: That post was for version 0.6.8. If the problem occurs in newer versions it should be basically the same fix.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic