GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Wordpress Gurus - Need help! (https://gfy.com/showthread.php?t=1087005)

Lace 10-26-2012 08:43 PM

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'); 
?>


Lace 10-26-2012 08:49 PM

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? :1orglaugh

Mr Pheer 10-26-2012 09:16 PM

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

Killswitch 10-26-2012 09:51 PM

Quote:

Originally Posted by Mr Pheer (Post 19277144)

http://i.imgur.com/zmm2m.jpg

CaptainWolfy 10-27-2012 12:45 AM

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

moeloubani 10-27-2012 12:59 AM

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

fris 10-27-2012 08:53 PM

please avoid doing a get_option lookup via every shortcode call.

PornMD 10-27-2012 10:40 PM

Quote:

Originally Posted by fris (Post 19278370)
please avoid doing a get_option lookup via every shortcode call.

Yes, please avoid doing that - it makes fris weep.


All times are GMT -7. The time now is 11:17 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123