WordPress.org

Ready to get started?Download WordPress

Forums

Calendar in dxx only shows on front page (7 posts)

  1. teejayuu
    Member
    Posted 8 years ago #

    Hi
    I am using dxx on WP 2.0.2. My problem is that the calendar shows on the main page in the sidebar, but if I click on one of the categories it no longer shows. Cna anyone tell me why this happens?
    Thanks
    TJ

  2. maerk
    Member
    Posted 8 years ago #

    Is dxx a theme? If so, I'm guessing that something like the code below appears in your sidebar:

    <?php if (is_home()) {
    wp_calendar();
    } ?>

    Could you post any code from the sidebar that you think might be relevant?

  3. teejayuu
    Member
    Posted 8 years ago #

    <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>
    <?php get_links_list(); ?>

  4. <h2><?php _e('Archives'); ?></h2>
      <?php wp_get_archives('type=monthly'); ?>
  5. <?php get_calendar(3); ?>

    This is the code in the side bar
    Thanks

  6. maerk
    Member
    Posted 8 years ago #

    Yeah, it's inside a conditional block, so it will only show up on the fron page or a page.

    In PHP (and many other languages) conditional blocks look a bit like this:

    if (some condition is true) {
    do this action
    }

    that means that the code "do this action" will only be executed if "some condition is true".

    In your case, <?php get_calendar(3); ?> will only be executed if the front page or a page is being shown (a "page" in wordpress is like an "about" section that isn't time-dependent, like blog posts are).

    You need to find the ending curly bracket } which signifies the end of the conditional block. That might be tricky to find, though (there will most likely be a bunch of else statements, which confuse the matter). If you like, you can paste the entire contents of sidebar.php onto pastebin.com, and I'll take a look at it for you.

  7. maerk
    Member
    Posted 8 years ago #

    You need to give me the link to the pastebin item, though ;)

  8. teejayuu
    Member
    Posted 8 years ago #

    Thanks maerk

    I have found the closing curly bracket and moved the command outside it which solves the problem. If you want to check my sidebar code it is at
    http://pastebin.com/739046

    Thanks tj

  9. maerk
    Member
    Posted 8 years ago #

    I'm glad it's working for you. I think you gave me the wrong pastebin link, but if it's working, then that's fine.

Topic Closed

This topic has been closed to new replies.

About this Topic