Sidebar Page Switcher

Posted on July 30th, 2006 by mark.
Categories: WordPress.


Overview

SPS - Sidebar Page Switcher a great little plugin which can be used to hide static subpages in the sidebar menu. The application has two options which can be used:

  1. Hide subpages by selecting "hide" in the new option added by the plugin to the "Write Page" tab in the admin window
  2. You can hide all none-useful pages, i.e. only the top level pages (without a parent_id) and the current tree pages up to one level down from the current page are displayed. See the "pages" section of the sidebar to the right of this article and try switching between pages to see their children.


Instructions

Get the zipfile from here. Unzip (er..unrar) and upload the plugin file "sidebar-page-switcher.php" to the plugin folder of WordPress and activate it on the plugins admin page.

Option 1

This part of the instructions covers option 1 - Hide the pages you don't want to see! 

Your first task is to edit your "sidebar.php" file. I would suggest saving a copy of the original ;-) . This file is found under the "themes" folder, in the folder of the same name as your current theme. Open "sidebar.php" search for the string "wp_list_pages" and replace it with "sps_list_pages" save/upload it to your server.

To enable this for individual pages you will need to go to "manage pages" press "edit " for the page you want to hide and you will notice a new option "Anzeigeeinstellungen" "Diese Seite in der Sidebar: ",  with the options "Anzeigen" and  "Ausblenden" to choose from. If your German isn't too great then select "Ausblenden" save the page and test it by viewing your site to see if it has disappeared.

If you would like to have your options written in English then visit the "plugins" section of the admin pages choose "plugin editor" and the SPS plugin scan down until you find the following string:

/* GERMAN - DEUTSCH */
$sps_lang = array ("DisplaySettings" => "Anzeigeeinstellungen",
    "ThisPage" => "Diese Seite in der Sidebar: ",
    "Show" => "Anzeigen",
    "Hide" => "Ausblenden"
    );

and delete it! 


Option 2

This part of the instructions covers option 2 - "Hide non-useful pages"

Your first task is to edit your "sidebar.php" file. This file is found under the "themes" folder, in the folder of the same name as your current theme. Open "sidebar.php" search for the string "wp_list_pages" then replace the whole string

<?php wp_list_pages('title_li='); ?> 

with

<?php sps_list_pages('title_li=&sort_column=menu_order&page_id ='.$posts[0]->ID);?>

 (you may want to copy this bit from the instructions in the plugin file itself just in case of any HTML issues)  then save & upload it to your server.

This is done without hiding pages in the "Write Pages" admin page. So go straight to the front page of your site and test it out.


0 comments.

Leave a comment

Comments can contain some xhtml. Names and emails are required (emails aren't displayed), url's are optional.