How Do I Only Include Child Pages of the Current Page in a Menu in WordPress?

Friday, September 28th, 2012

WordPressI ran into an interesting problem the other day. I wanted to have a menu on the left side of the screen that only displayed the title of pages that were sub pages of the current page. In other words the current page title may be About US. On the left I wanted the sub pages listed. The titles of these pages may be Our Vision, Our Leadership and Contact Us. It seems pretty simple. I only wanted the first level of sub pages. If Our Vision had any child pages I didn’t want these sub pages until I was on the Our Vision page.

What I needed to do was to create a new PHP file called sidebar_left.php.  Then include this file where I wanted the sidebar to appear. This can be done using the following code in the PHP file that controls the page I want to add this menu. In this case that was the page.php file:

<?php include(TEMPLATEPATH."/sidebar_left.php");?>

Now I had the way to include the file all I needed was the code that would give me the menu. The following code is what I decided on:

 

<div id="sidebar_left">
    <?php
      $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0&depth=1');
      if ($children) { ?>
      <ul>
      <h3><?php echo $children; ?></h3>
      </ul>
  <?php } ?>
 </div><!-- #sidebar_left -->

 

The line of code that accomplished what I wanted was

wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0&depth=1')

 

The code that says:

        child_of='.$post->ID

specifies to only include pages that have the current page as the parent.

 

The section that says:

         depth=1

will only include the top level of pages, so no grand children pages will be displayed.

 

The section that says:

         echo=0

tells WordPress to return an HTML text string to be used in PHP

 

If you have any unusual problems with either WordPress or PHP email me. I am available as a consultant. I also create custom websites from the ground up.

8 Steps to Select a WordPress Theme

Monday, July 23rd, 2012

WordPress LogoThere are thousands of WordPress themes available on the market today, many of those themes are free, while others you need to pay for. Out of the paid themes there are two options. Purchase a predefined theme or pay a developer to create your theme from scratch. So which option is best for your small business WordPress website?

Should I Choose a Free WordPress Theme?

Free WordPress themes have been the option of many small business website owners. Many free WordPress themes include unwanted code. This code is often imbedded to make it difficult to find. The code often provides the designer of the theme with some benefit. Often it is free links or some other traffic oriented benefit. This is a tradeoff that you need to be aware of.

Before you choose a WordPress theme for your small business website you need to know what you want to use the theme for. WordPress was originally developed for managing traditional text blogs. This is no longer the case. WordPress has many uses.

What can WordPress be Used For?

A few uses or WordPress are:

  • Photo blogs – Many photographers use WordPress to present their portfolios online for perspective customers to view.
  • Business websites – WordPress can be used for any business owner such as dentists, landscapers, consultants or online schools.
  • Video blogs – more and more people are using video only blogs to share their thoughts with the world.
  • Product websites – these websites focus on a single product rather than a company. A company may have many product websites, each one containing only one product.
  • Corporate websites – Ford motor company created a blog to describe their story. They create articles to engage their visitors and build relationships.
  • Magazine websites – Many online magazines use WordPress to manage their websites and provide a mechanism for visitors to comment on their websites. People magazine’s style watch is a good example.

The type of business and use of WordPress will vary depending on how you plan to use it.

What Criteria Should I Consider when Choosing a WordPress Theme?

  1. SEO Friendly. No matter what your website will be used for you will need to be able to be found in search engines. Most free themes are not SEO friendly. The SmallBIZ theme by Expand2Web is excellent for SEO and small businesses
  2. Customizable color schemes. Most people have corporate colors or just a color preference. Does the WordPress theme have the option to change the color scheme, such as background color and accent? This is simple to accomplish, but very powerful.
  3. Easily customizable header. Everyone wants to include their own logo on their website. The header is the obvious place to put it. Does the theme you are looking at allow you to use your own header or modify the provided header to include your logo?
  4. Widgetized. Widgets add easy customizable areas such as sidebars or menu areas. WordPress has many widgets installed by default that make your website user friendly. Does the WordPress theme include areas that are wdgetized?
  5. Well reviewed. Read reviews on independent websites to determine if the WordPress theme is popular and well received.
  6. Support. Once you install the WordPress theme you may run into problems. Is there any technical support available? How easy is it to get in touch with someone?
  7. How many blogs use the same theme? If a theme is used by thousands of different websites how likely are you to be able to stand out in the crowd? Check other website in your niche and see if you can tell if they are using WordPress and what theme are they using.
  8. Can you grow with this theme? Are there features that you may be able to use as your website grows? Can you add new functions or areas as you grow?

Once you have decided what features your want and need the next step is to look at each WordPress theme. There are a few WordPress Theme designers that rise above the rest in my opinion. You can use this list to start your process. It is not a complete list, just the best that I have found.

What Are the Best WordPress Themes?

expand2web logoExpand2Web has the best interface for small businesses. They have a completely seamless interface for ensuring proper Search Engine Optimization (SEO). You can easily switch between 8 different layout options. There are 16 different banner styles to choose from or you can upload your own. This theme is just what a small business owner needs to manage their small business WordPress website and plenty of room to grow. To find out more or to purchase the SmallBiz theme click here.

Studiopress LogoStudio Press offers the best all around options for WordPress themes that I have found. Their Genesis Framework themes are search engine optimized (SEO), offer 43 turnkey designs, provide unlimited support, provides the best security you can find in  WordPress Theme and is easily customizable. These guys are the best. To find out more or to purchase Studio Press click here.

elegant themes logoElegant themes has made a good reputation They have put a ton of time into making the themes not only elegant, but user friendly and versatile. They provide full control over Search Engine Optimization (SEO), navigation and layout.To find out more about their themes or to sign up click here.

Theme Forest has created some very professional looking business themes. Their themes are affordable, professional and easy to use. They have a theme called RT-Theme 5 / Business Theme 10 in 1 for WordPress. This is a highly customizable set of themes for business web sites. They are clean and fast. To find out more about their themes or to purchase them click here.

WPZOOM has created some impressive themes. They are Search Engine optimized (SEO) so that your visitors will be able to find you better when they look for you on Google. Take a look at the WPZOOM – Premium WordPress Themes here.

%d bloggers like this: