View Single Post
Old 10-26-2012, 08:43 PM  
Lace
Too lazy to set a custom title
 
Lace's Avatar
 
Industry Role:
Join Date: Mar 2004
Posts: 16,116
Wordpress Gurus - Need help!

Trying to find a way to show TripAdvisor reviews on a blog, and found this plugin - http://wordpress.org/extend/plugins/...sor-shortcode/

I have already edited it from .co.uk to .com and removed a few things that I did not need to show up, but it keeps showing at the beginning of the post when I have the short code added to the bottom of the post.

Is there any easy way to fix this, or is it some complicated code? If it's complicated, I'll just wait or email the author and see if he can change it.

Here's the code
Code:
<?php

// set up menu and options page.

add_action( 'admin_menu', 'tripadvisorsc_menu' );


function tripadvisorsc_menu() {
	add_options_page( 'tripadvisorsc', 'TripAdvisor SC', 'manage_options', 'tripadvisorsc', 'tripadvisorsc_options' );
}

add_action ('admin_init', 'tripadvisorsc_register');

function tripadvisorsc_register(){
register_setting('tripadvisorsc_options', 'tripadvisor_url');
register_setting('tripadvisorsc_options', 'tripadvisor_name');
register_setting('tripadvisorsc_options', 'tripadvisor_id');
}

function tripadvisorsc_options() {
	if ( !current_user_can( 'manage_options' ) )  {
		wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
	}
	?>
	<div class="wrap">
	<h2>TripAdvisor Shortcode</h2>
	<div id="donate_container">
      Help keep this plugin in development and improved by using my Amazon links to make your purchases. Your commission can help support all my free Wordpress plugins. <a href="http://ypraise.com/2012/08/plugin-donate-page/">My Amazon page</a>
    </div>
	
	<p><form method="post" action="options.php">	</p>
	<p>Add the url of the hotel or accommodation from Tripadvisor:</p>
	
	<?php
	
	settings_fields( 'tripadvisorsc_options' );
	
?>
<p>Add business url from TripAdvisor (exclude the http://tripadvisor.co.uk/): <input type="text" size="80" name="tripadvisor_url" value="<?php echo get_option('tripadvisor_url'); ?>" /></p>
<p>Add business name to display at top of feed (ie Reviews of BUSINESS NAME ): <input type="text" size="80" name="tripadvisor_name" value="<?php echo get_option('tripadvisor_name'); ?>" /></p>
<p>Add Tripadvisor ID (the dxxxxxx number in your url - do not include d: <input type="text" size="80" name="tripadvisor_id" value="<?php echo get_option('tripadvisor_id'); ?>" /></p>

 <?php


	
 submit_button();
echo '</form>';

	
	echo '</div>';
}



// lets build the shortcode



function tripadvisorscode($atts) {

$name = get_option('tripadvisor_name');
$url = get_option('tripadvisor_url');
$id = get_option('tripadvisor_id');

extract( shortcode_atts( array( 
    'name' => $name,
    'url' => $url,  
	'id' => $id, 
), $atts ) ); 


?>
<script  src="http://www.tripadvisor.com/FeedsJS?f=hotels&defaultStyles=n&d=<?php echo isset($atts['id']) ? $atts['id'] : get_option('tripadvisor_id') ?>&plang=en"></script>
<script>window.realAlert = window.alert;
window.alert = function() {};</script>

<div id="TA_Link"><a href="http://www.tripadvisor.com/<?php echo isset($atts['url']) ? $atts['url'] : get_option('tripadvisor_url') ?>">Reviews of   <?php echo isset($atts['name']) ? $atts['name'] : get_option('tripadvisor_name')  ?> from TripAdvisor.com</a></div>
<div id="TA_Container"></div>

<?php

}

add_shortcode('tripadvisorsc', 'tripadvisorscode');  
?>
__________________
Your Paysite Partner
Strength In Numbers!
StickyDollars | RadicalCash | KennysPennies | HomegrownCash
Lace is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote