Here are some nice wordpress shortcodes for you to use

Here are some nice shortcodes for you to use:


1. Easy to add twitter & facebook share button Shortcode

function shreplz() {
   return '
    <div class="sharebox">
    <div class="twittme"><a href="https://twitter.com/share" class="twitter-share-button" data-count="horizontal">Tweet</a><script type="text/javascript" src="//platform.twitter.com/widgets.js"></script></div>
    <div class="shareface"><a name="fb_share"></a> <script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script></div>
    <br style="clear: left;" />
    </div>
   ';
}
add_shortcode('sharethis', 'shreplz');
// how to use: [sharethis]

2. Easy Remote site snapshot using WordPress API shortcode

function wpr_snap($atts, $content = null) {
        extract(shortcode_atts(array(
            "snap" => 'http://s.wordpress.com/mshots/v1/',
            "url" => 'http://www.sagive.co.il',
            "alt" => 'My image',
            "w" => '400', // width
            "h" => '300' // height
        ), $atts));

    $img = '<img src="' . $snap . '' . urlencode($url) . '?w=' . $w . '&h=' . $h . '" alt="' . $alt . '"/>';
        return $img;
}

add_shortcode("snap", "wpr_snap");
//how to use: [snap url="http://www.example.com" alt="Cool Site!" w="300px" h="200px"]

3. Easy to use & embed iFrame Shortcode

function GenerateIframe( $atts ) {
    extract( shortcode_atts( array(
        'href' => 'http://the-url',
        'height' => '550px',
        'width' => '600px',     
    ), $atts ) );

    return '<iframe src="'.$href.'" width="'.$width.'" height="'.$height.'"> <p>Your Browser does not support Iframes.</p></iframe>';
}
add_shortcode('iframe', 'GenerateIframe');
// how to use: [iframe href="http://www.exmaple.com" height="480" width="640"]

4. Easy to include remote file / doc with Shortcode

function getfile_content( $atts ) {
  extract( shortcode_atts( array(
    'fileurl' => ''
  ), $atts ) );

  if ($fileurl!='')
    return @file_get_contents($fileurl);
}

add_shortcode( 'getfile', 'getfile_content' );
// how to use: [getfile fileurl="http://www.exmaple.com/somepage.html"]

.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *