Wordpress Gurus - Need help!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Lace
    Too lazy to set a custom title
    • Mar 2004
    • 16116

    #1

    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
    Too lazy to set a custom title
    • Mar 2004
    • 16116

    #2
    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

    Comment

    • Mr Pheer
      So Fucking Banned
      • Dec 2002
      • 22083

      #3
      http://www.w3schools.com/php/default.asp

      Comment

      • Killswitch
        REVOLUTIONARY
        • Oct 2012
        • 2567

        #4
        Originally posted by Mr Pheer

        Comment

        • CaptainWolfy
          Playa
          • Dec 2005
          • 8439

          #5
          http://www.tuxradar.com/practicalphp
          there u go..

          Comment

          • moeloubani
            Confirmed User
            • Dec 2007
            • 4235

            #6
            what keeps showing at the beginning of your posts? hit me up on skype moeloubani ill take a look

            Comment

            • fris
              Too lazy to set a custom title
              • Aug 2002
              • 55679

              #7
              please avoid doing a get_option lookup via every shortcode call.
              Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

              Comment

              • PornMD
                Mainstream Businessman
                • Jan 2007
                • 9291

                #8
                Originally posted by fris
                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.

                Comment

                Working...