ShareThis Forums » The ShareThis WordPress Plugin

hide button on specific pages

(3 posts)
  • Started 5 months ago by mostwantedchineseplayingcards
  • Latest reply from adennetworks

  1. Everyone seems to want their missing button to show.
    I on the other hand would like to hide the button.
    Can it be so?
    If so how?
    This I wonder...

    Posted 5 months ago #
  2. How would you like to hide the button, and for what purpose? I'm happy to help.

    Posted 5 months ago #
  3. ShareThisSupport,

    I'm looking to do this as well because I use a page template plugin called template-redirect. It allows me to redirect a page to a website. I like Alex King's development work and decided to try ShareThis.

    I copy this template-redirect.php to my theme directory and it shows below the post in the "Page Template" area. You can see this on my blog http://butyoureagirl.com for the page called Aden Networks.

    Developer - Dave Stewart
    The developer's site
    www.davestewart.co.uk
    His blog post explaining the code http://www.keyframesandcode.com/code/development/php/wordpress/wordpress-template-page-redirect/

    Here is the code from the file:

    <?php

    /*
    Template Name: Page Redirect

    * @author Dave Stewart
    * @web www.davestewart.co.uk

    * @name Page Redirect
    * @type PHP page
    * @desc Wordpress template that redirects the current page based on the content of the database entry it loads

    * @requires Wordpress
    * @install Copy this file to the directory of the theme you wish to use
    * usage
    1. Create a new Page in your Wordpress control panel
    2. Enter the URL (or local path, relative to your Wordpress directory) you want to redirect to as the only page content
    3. Set the Page Template to "Page Redirect"
    4. Publish
    */

    if (function_exists('have_posts') && have_posts()){
    while (have_posts()){

    // get the post
    the_post();

    // get content
    ob_start();
    the_content();
    $contents = ob_get_contents();
    ob_end_clean();

    // correctly build the link

    // grab the 'naked' link
    $link = strip_tags($contents);
    $link = preg_replace('/\s/', '', $link);

    // work out
    if(!preg_match('%^http://%', $link)){
    $host = $_SERVER['HTTP_HOST'];
    $dir = dirname($_SERVER['PHP_SELF']);
    $link = "http://$host$dir/$link";
    }

    // do the link
    header("Location: $link");
    die('');
    }

    }
    ?>

    Posted 5 months ago #

RSS feed for this topic

Reply

You must log in to post.