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]
- Allowing user to edit only certain pages
- Add a Page without header and menus?
- Strategy for handling hierarchical pages with empty parent content
- Find empty pages or pages which have less than x characters
- Hide page visual editor if template is selected – redux
- Page template gives ‘Parse error: syntax error’ when used, but no error found!
- more tag in the $post->content when get_pages were used
- How to get the list of posts in a static page other than front page?
- Using JavaScript and JQuery in Page
- How can I make Disqus comments not show up on pages?
- CMS: Making complex pages editable by the end user
- Guidelines for adding static pages
- Show child pages when on a child page
- Sitewide page on all the blogs in the network
- How to create a page when a theme is activated?
- Creating a form contact page?
- How to call wp_list_comments() outside of the comments template?
- Can’t see content on page to edit
- Show own shortcode data on each page
- How can I get the homepage from the loop?
- How do I Name a WP page in the New(ish) Block Editor?
- Make multiple pages and set template/content on theme activation?
- Where can i make an html change to a specific page [closed]
- This code won’t find authors page?
- WordPress backend:How to hide some specific pages under Pages–>All Pages
- Different header for each page in child theme of twenty thirteen
- Change a Page’s Header Image
- Use content from one page in another template
- Is it possible to change slugs’ default behaviour?
- List child pages within page template
- on page creation few inline style properties gets removed
- way to make all pages with certain tags public?
- Page not appearing under its Parent
- return page name in url
- Search anything from a Child and Sub-Pages of their Parent page
- Can i use 2 page content-forum & content-forum-slug on bbpress?
- register_rest_field only for specific page
- Change page width in refined magazine/mag and news theme
- How do you run code on a specific page without missing the init hook?
- if is_page() is not working with wp_redirect
- Display meta data attribute in user profile
- Assign Parent Page – Now 404 Error
- WordPress displays widgets out of whack
- WordPress form submit to custom page template does not work
- Customise the_title in admin area
- Add pagination to search.php page
- How do I get my page “About” to show up on my WordPress site?
- custom page or standalone page?
- Multiple pages to show posts
- How to finish this loop?
- Is it possible to rewrite a page url Without setting the permalinks to Post Name?
- All the pages are blank [closed]
- Get ID of the page where shortcode is included
- How to achieve anchor links on top of pages.
- how to list subpages in sidebar without widget
- Static front page with excerpt
- Some informations about the use of statics pages in WordPress
- if and else statement not working on the iframe php page
- How to set a default page for load first time?
- Display multiple page contents under single page