I am not exactly sure what you’re question is but I think you are looking for something like this, mostly cribbed from the Codex:
if ( is_active_sidebar( 'sidebar-1' ) ) { ?>
<ul id="primary"><?php
dynamic_sidebar( 'sidebar-1' ); ?>
</ul><?php
}
If the sidebar is not in use, no markup will display. You could add an else
is you want:
if ( is_active_sidebar( 'sidebar-1' ) ) { ?>
<ul id="primary"><?php
dynamic_sidebar( 'sidebar-1' ); ?>
</ul><?php
} else {
<ul id="secondary"><?php
// some other code ?>
</ul><?php
}
Related Posts:
- Add infinite scroll to content splitted post
- Get the content of a specific page (by ID)
- How can I keep the content of my pages version controlled?
- What methods to use to create small, editable pieces of text for static pages?
- How to add a specific widget to only 1 page?
- Editing Complex Pages in Visual Mode
- Can I display the widget admin in the page admin?
- Multiple areas of dynamic content in a page
- What is the best way to include a widget in a Page?
- Modify theme to get page excerpts on front page
- Static files or dynamic WP pages for “static content”?
- The entire content of my WordPress page has disappeared
- What is the proper way to get contents of a page?
- Get the Page Content,without generating HTML
- How to modify the default WordPress ‘Pages’ widget to have titles on the anchor tags?
- Page displays content from different query?
- I can’t edit my homepage – the page editor is just blank [closed]
- Having wordpress page accesss issue under sub-directory
- How to make my category archive behave like a page
- The concept of non-blog content
- If I use a static page-slug.php for a page, is the database still queried?
- How To Render Shortcode In AJAX Response?
- append one page content into another
- Do I have to widgetize my pages?
- Two different pages that share the same content?
- How to automate setup of theme, pages, widgets, etc for a new site in multi-site?
- upgrade has caused page content to disappear
- add title to widgets of wordpress
- Add the same content to multiple pages
- Add homepage to the list of pages in the Footer Widget
- Cannot pull WYSIWYG content
- Editing pages from dashboard
- What’s the best way to manage sections on a page?
- How can I add a new page in the pages tab that belongs to specific theme?
- How to get sort content by page id?
- Widget & storing a Select box choice
- Add text to the bottom of particular pages
- Page specific values in widgets
- Retrieve page content and pass to PHP?
- wordpress pinboard theme [closed]
- How do you add a filter to wp-block-page-list?
- Check if wp-login is current page
- How to get current page ID outside the loop?
- Contact Form on WordPress Sites?
- Page returns 404 with POST variables, but not without
- Custom templates not showing up in template dropdown
- Get page id by template
- Using pre_get_posts on true pages and static front pages
- How to get page title with the page ID?
- Show more than 20 items in pages or posts edit dashboard
- Allowing user to edit only certain pages
- How to display last 3 posts (recent posts) in a static page?
- How to give paged links custom title?
- How to set post slug when using wp_insert_post();?
- How to load javascript on custom page template?
- How to configure WordPress to handle 75,000 pages?
- How to update page status from publish to draft and draft to publish
- Check if is on child-page of a particular page
- Change page template programmatically ?
- Conditional tag to check if ‘page.php’ is being used?
- Customizing the URLs of WordPress Login and Sign-up Pages?
- How to disable posts and use pages only
- featured image as background image on pages
- Check IF is a “single product page” and Check the “role” for a Redirect
- A check for if is parent page, if has children, if has grandchildren
- How do register_sidebar() and get_sidebar() work together?
- How to load JS and CSS only on specific Pages using is_page()?
- Listing pages which uses specific template [duplicate]
- Proper way to get page content
- Access the same page from multiple urls (wildcard)
- Create a page without adding a page in the Database
- Get content from one page and show it on another page
- Is there a way to change the default page template selection?
- Can I have two child pages of different parents with the same name?
- How can I get the title attribute from get_the_post_thumbnail()?
- Show Default Editor on Blog Page ( Administration Panel )
- Hide page visual editor if certain template is selected?
- What is the difference between $paged and $page?
- multi page password protection
- Create a “Dummy” parent page for a hierarchy in page listing?
- How do I convert a page’s title to lower case?
- Get top level page parent title
- Switching themes without losing widgets?
- Restrict admin access to certain pages for certain users
- page title, parent tilte and grand parent title
- How to add jQuery script to an individual page?
- Should I use set_transient or update_option?
- WordPress page edit does not save selected template
- Add a Page without header and menus?
- What is an alternative to get_page_by_title()?
- Password protect page with multiple passwords
- can require “themefolder/includes/widgets.php” in “themefolder/functions.php” yet widgets.php doesn’t run
- Strategy for handling hierarchical pages with empty parent content
- Create pages automatically if they don’t exist
- Find empty pages or pages which have less than x characters
- Having different sidebar content for MANY pages?
- Allow only new sub-pages to be created
- Set page template automatically based on parent
- Link section within page with slash (/) and not hash (#) without reloading the page
- How to enable edit button in the theme’s customize UI?