• I have been looking for a solution to hide sidebar from my pages. Yes i know its not a big thing, we can use template for that.

    But in my case i did not wanted to use templates because its not easy for end user to create template to use plug-in; so i was looking for some easiest way to render my page from plugin without sidebar.

    So i used Shortcode for this purpose. I provided simple Shortcode to user to keep in Pages. And inside Shortcode i kept following PHP script to hide sidebar.

    echo "<style>";
    echo "#sidebar {display:none;}";
    echo "</style>";
    echo "<script type='text/javascript'>";
    echo "document.getElementById('content').style.width='95%'";
    echo "</script>";

    Its works well for me. I want your suggestions and any other way to do this.

    Thanks
    LampRomy

Viewing 2 replies - 1 through 2 (of 2 total)
  • I want to re-include the sidebar on a password protected page. I hid the sidebar a long time ago and can’t remember how I did it. I know I created a snarfer template, and I’ve set the page back to the default. But still no sidebar. You can see it here.

    Thread Starter lampromy

    (@lampromy)

    i think its quite easy in my case..

    echo "<style>";
    if($_GET['page_id']==10){
      echo "#sidebar {display:block;}";
    }else{
      echo "#sidebar {display:none;}";
    }
    echo "</style>";
    echo "<script type='text/javascript'>";
    echo "document.getElementById('content').style.width='95%'";
    echo "</script>";

    If i know how you hide your side bat i can suggest something.
    One more thing.. i used wordpress standard login page for client authentication. This code automatically takes on login page and return on requested page after successful login. You need to place below code on top of the page.

    if(!function_exists(is_user_logged_in)){
      	  die('Sorry, You do not have access of this page.');
      }
      if ( !is_user_logged_in() ) {
    	$returnPath = get_settings('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI']);
    	echo "<script type='text/javascript'>";
    	echo "window.location.href='$returnPath'";
    	echo "</script>";
    	exit();
      }
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Hide Sidebar From Dynamic Page Coming from Plugin’ is closed to new replies.