This is how I do it in a custom theme:
<h3>Select pages to include in menu:</h3>
<p>
<?php
$page_ids = get_all_page_ids();
$current_selected = get_option("pages_to_include");
foreach( $page_ids as $page_id ) {
if( get_post_status( $page_id ) == 'publish' ) {
$checked = ( !empty( $current_selected ) && in_array( $page_id, $current_selected ) ) ? ' checked="checked"' : '';
echo '<input type="checkbox" name="page_to_include[]" id="page-' . $page_id . '" value="' . $page_id . '"' . $checked . ' /> <label for="page-' . $page_id . '">' . get_the_title( $page_id ) . '</label><br />';
}
}
?>
</p>
You store the pages list in an option (here is "pages_to_include"
).
Related Posts:
- Add custom classes to anchor in wp_nav_menu
- Any official way to create an admin theme?
- How to make a theme with more than one CSS file?
- Select menu on browser resize
- Displaying wp menus by name without using theme locations
- How to highlight the current page in the nav menu?
- Setting a Default ‘Theme Location’ When Creating a Menu
- Add social icons in a theme through custom admin menu
- Different Admin Theme – Based on Role?
- Custom Nav Walker Displaying Values in Sub Menu
- Where is definied the theme location for the main menu in a WordPress template?
- How can I display/hide certain content based on a Theme Option field?
- My Admin bar covers my sticky navbar [closed]
- How to make theme elements customizable in wordpress?
- Where am I doing wrong in my theme menu?
- Admin: sub menu doesnt display under apperance when activate my themes
- 3 Level Deep Navigation Menu Not Showing All Levels
- How to add menù section to my WordPress template?
- Why is my container argument not working for wp_nav_menu() [closed]
- Some doubts about WordPress handle the horizontal main menu visualization
- How to remove permalinks links presents in each page of my site?
- how to create/register menu items that can be added to menus later
- Why nav_menu_css_class doesn’t work with apply_filters?
- Theme: dropdown hover menu not showing up in IE/Edge
- Menu names not getting translated
- Primary Menu Showing All Pages With No Sub-Nav
- What’s the policy for building a theme that doesn’t support widgets/menus?
- How to make navigation a list without a plugin? [duplicate]
- How to automatically set a Template Page Name next to a page in menu screen such as WooCommerce pages, front page, or posts page in wordpress?
- Dynamic nav menu with icons [closed]
- Add a dropdown to theme customizer
- wp_nav_menu sort order?
- What is the problem if I use CDN in my WordPress parent theme(built using bootstrap)?
- Any walker causes blank menu?
- Grab the first paragraph of each post
- How to check if post has any tag?
- The best way to customize “nav-menu-template.php” to add if the ‘link_before’ is “checkbox”
- Get last modified date for menu link
- “Cheatin’ uh?” error message on multple theme directories
- Adding WordPress colorpicker in widget settings
- A theme that follows all the best practices to learn from?
- get_post() function returns post even if it is trashed
- “Display Site Title and Tagline” checkbox not working?
- file_get_contents Not allowed in Themes?
- CSS won’t style output of wp_nav_menu() correctly
- Making menu link open in new tab?
- How do I remove twentyten without ruining what I did?
- Custom theme not visible in Appearance
- Developing WordPress Theme using CSS framework like Bootstrap
- WP_Customize_Color_Control omitting # symbol
- Theme translation not applying
- How to add filter the post thumbnail before save in database?
- WordPress empty Nav Menu error
- Storefront child theme not applying parent theme [closed]
- How to set the currently active page in the menu including parents
- Override customizer values on a per-menu base
- Theme Inspector “X-Ray”
- Acivate all themes multisite wide automatically
- How to place HTML tags in content from the_content()?
- WordPress Theme Creation [closed]
- What is the meaning of WordPress’s recommended css classes and where are they applied?
- How to remove text “Log In” from login page
- How do you use WordPress for a website that’s not in a blog format?
- Why wp_nav_menu() doesnt show the proper meny when invoked two consecutive times?
- Why are some of my menu items not displaying on my menu?
- Managing WordPress Theme
- Can’t use admin_enqueue_scripts or wp_enqueue_script
- theme style is applied on the dhasboard rather than the website
- Alignment Problem [closed]
- What $handle does WordPress use for a theme’s implicit style.css?
- how do i develop a global nav and local nav to be wordpress dynamic?
- Unwanted empty line at the beginning of document
- best practices for updating wordpress theme
- help needed for suit designing tool
- How to modify theme content in Thematic?
- if (has_custom_menu())?
- Making a horizontal flyout menu from WordPress category listing
- How to update mark-up of a gallery block in a custom theme?
- My wordpress theme name isn’t updating straight away
- Customizer API Multi Sections in single Panel
- WordPress theme options checkbox default checked state
- Copying a modified theme from one wordpress site to another wordpress site [closed]
- Adding a second logo next to the main one in header
- Cold Fusion to WordPress
- How to show some of category in wordpress
- using themename_the_custom_logo() in template-tags?
- Creating a theme just to deploy a single page
- Nav menus Fast previewing not working with wp_get_nav_menu_items!
- Custom page template not showing on page creation
- Weird ‘theme update’ error [duplicate]
- How to remove menu from WP-Admin menu
- Main Menu Theme Different Output Print
- WordPress two sidebar layout or theme
- How do I move menu to the bottom in Custom Community theme?
- Standard Way To Do Custom Work Within A Page?
- How can I install my custom-made theme on a wordpress.com blog? [closed]
- How do I middle-align my header menu items in WordPress [closed]
- .submenu class missing in output from wp_nav_menu
- How to make a multilingual wordpress site to be translated one-to-one without much effort and without using translate?
- Is there a way to have WordPress autodetect page templates in the page-templates directory and any sub-folders?