WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Dynamic sidebar - only show on certain page (3 posts)

  1. matthisco
    Member
    Posted 2 years ago #

    Can someone please tell me if I can use the following to show a widget in the sidebar:

    This is my code but it doesn't work:

    <?php if ( ! dynamic_sidebar( 'sidebar-1' ) && is_page('page-name')) : ?>
    //show widget
    <?php endif; // end sidebar widget area ?>
  2. Chip Bennett
    Theme Review Admin
    Posted 2 years ago #

    Try this instead:

    if ( is_page( 'page-name' ) ) {
        if ( ! dynamic_sidebar( 'sidebar-1' ) ) {
            // Show Widget
        }
    }
  3. matthisco
    Member
    Posted 2 years ago #

    thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic