Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 10-26-2012, 08:43 PM   #1
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
Old 10-26-2012, 08:49 PM   #2
Lace
Too lazy to set a custom title
 
Lace's Avatar
 
Industry Role:
Join Date: Mar 2004
Posts: 16,116
Found this in another plugin
Code:
// Add the shortcode once for each map
		$shortcodes = "";
		foreach($maps as $map)
			$shortcodes .= '<p>[mappress mapid="' . $map->mapid . '"]</p>';

		if ($autodisplay == 'top')
			return $shortcodes . $content;
		else
			return $content . $shortcodes;
	}
So I guess I need to change a few things and use $content . $shortcodes;

Why didn't I ever take the time to learn php?
__________________
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
Old 10-26-2012, 09:16 PM   #3
Mr Pheer
Top Rated CEO
 
Mr Pheer's Avatar
 
Industry Role:
Join Date: Dec 2002
Location: Las Vegas
Posts: 21,885
http://www.w3schools.com/php/default.asp
__________________
Mr Pheer is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-26-2012, 09:51 PM   #4
Killswitch
👏 REVOLUTIONARY 👏
 
Killswitch's Avatar
 
Industry Role:
Join Date: Oct 2012
Posts: 2,495
Quote:
Originally Posted by Mr Pheer View Post
__________________
Killswitch is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-27-2012, 12:45 AM   #5
CaptainWolfy
Playa
 
CaptainWolfy's Avatar
 
Industry Role:
Join Date: Dec 2005
Location: Somewhere on the Earth
Posts: 8,439
http://www.tuxradar.com/practicalphp
there u go..
CaptainWolfy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-27-2012, 12:59 AM   #6
moeloubani
Confirmed User
 
moeloubani's Avatar
 
Industry Role:
Join Date: Dec 2007
Location: Ontario
Posts: 4,235
what keeps showing at the beginning of your posts? hit me up on skype moeloubani ill take a look
moeloubani is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-27-2012, 08:53 PM   #7
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,476
please avoid doing a get_option lookup via every shortcode call.
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


My Cam Feeds Script
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-27-2012, 10:40 PM   #8
PornMD
Mainstream Businessman
 
PornMD's Avatar
 
Industry Role:
Join Date: Jan 2007
Location: San Diego
Posts: 9,291
Quote:
Originally Posted by fris View Post
please avoid doing a get_option lookup via every shortcode call.
Yes, please avoid doing that - it makes fris weep.
__________________
Want to crush it in mainstream with Facebook ads? Hit me up.
PornMD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.