Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6670751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:18:21+00:00 2026-05-26T03:18:21+00:00

Hi creating new theme in wordpress. Having prob with sidebar, it should display the

  • 0

Hi creating new theme in wordpress.

Having prob with sidebar, it should display the main parent title then all the children.

<?php if ( !function_exists('register_sidebar')|| !register_sidebar() ) : ?>
    <ul id="sidebar">
        <?php
        if($post->post_parent){
            $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
            $title_heading = get_the_title($post->post_parent);
        } else {
            $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
            $title_heading = get_the_title($post->ID);
        }

        if($children) { ?>

        <li><h3><?php echo $title_heading; ?> </h3>
            <ul>
                <?php echo $children; ?>
            </ul></li>
        <?php } ?>
    </ul>
    <?php endif; // end primary widget area ?>

but its not displaying anything.

It shows the sidebar div in firebug so is displaying sidebar.

Its on localhost so cant give url.

All help appreciated

Cheers
Joe

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:18:22+00:00Added an answer on May 26, 2026 at 3:18 am

    I can see one of two problems:

    1. You have a sidebar registered, which means the condition is passed and it’s trying to use the widgetized sidebar; you do not have widgets in your sidebar so it is not showing anything. (in other words, if you have a sidebar, the above code will never display anything anyhow).

    2. You do not have a sidebar registered, so it’s passing the condition. However, the next conditions are not passed because they’re not met OR because the loop hasn’t triggered yet and you do not have access to those variables.

    Quick and cheap way to see if conditions are met is to simply echo out some plain text or markup just inside each condition:

    ...
    if($post->post_parent){
       echo('Parent found');
    ...
    

    (for example)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am relatively new to wordpress, I am creating a custom theme, and so
I'm creating a new WP theme and I would like to allow the user
I'm creating a new Drupal theme. Until now, I only needed to include a
i am creating a related post article feature for my wordpress enabled site.being new
I am creating a new plone.app.theming (Diazo) theme for my site. My rules.xml has
I am creating a new theme for my cms using scss. I am currently
I am creating a wordpress theme for a record label. One aspect is the
After creating a new Silverlight application from the JetPack theme template that was installed,
I've tried creating a new post on my Wordpress blog and I've pasted an
I'm creating a new theme in Orchard v1.3. Coming from 1.2 creating custom zones

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.