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]
- Why is wp_nav_menu() not removing the container around the nav ?
- How to Have a Pure HTML Sub Directory In WP Site
- How to correctly enqueue the parent and child theme stylesheets in the creation of a child theme? [duplicate]
- Create a child theme from multiple themes
- Theme not showing up
- html5-reset theme does not show the image [closed]
- Managing WordPress Theme
- Theming Using Bootstrap Glyphicons and WordPress Dashicons
- Can’t use admin_enqueue_scripts or wp_enqueue_script
- featured content: which area does this cover [closed]
- Second menu has the first menu ID
- Change image size depending on page
- How to include a file only on dashboard widgets page?
- WordPress page/blog incorporated into static website
- Theme Customizer not displaying saved values in wp_head (CSS)
- Random white space before doctype
- Adding a gallery to my first theme
- Are seven additional image sizes are too many?
- What are the critical theme files when building a custom theme?
- Having issue with WordPress wp_enqueue_style
- How can I use the WordPress Loop and Pagination in multiple instances but different scenarios throughout my site?
- Starting point for custom Themes [closed]
- How can I hard code my sidebar?
- What exactly is “wordpress theming”? [closed]
- Simple child theme modification but links are broken
- Theme Development -> Specific Homepage
- wp_nav_menu and its fallback
- Making a WordPress theme based on twentyten
- registering a global template wordpress 6.0
- How can I wrap all blog posts image with
- theme style is applied on the dhasboard rather than the website
- Copying the theme style files and images to duplicate the website but with a difference
- Why still output /wp-content/themes/twentynineteen?
- I have WordPress setup on primary domain, how do I set it up on its subdomain using the same database?
- Theme development – Automatically menu creation
- Which cache is kicking
- How to set Post meta-box defaults based on the choices made by user in Customizer?
- Theme Action to hook for one time only function [duplicate]
- Alignment Problem [closed]
- What $handle does WordPress use for a theme’s implicit style.css?
- searchform.php doesn’t work properly
- Issue when posting updates/changes to wordress
- How can i make multilevel menu in wordpress theme with bootstrap
- how do i develop a global nav and local nav to be wordpress dynamic?
- Customizer: get_preview_url() inside customize_save_after hook
- Valid SQL query not returning results
- Theme development: How to add CSS classes to menu items?
- How to track a users last visited page?
- get_header action not working
- Navbar- disable “onClick” drop-down
- In a Gallery with limited image posts, how do I not limit images on single post?
- Shortcodes do not work in own template
- Adding Bootstrap to WordPress TwentySixteen Theme
- Unable to change the priority with ‘remove_action’ and ‘add_action’ in child theme
- LESS not working in WordPress [closed]
- StoreFront WordPress theme: How can i create a new Home page with Custom design same as template [closed]
- How do I include a partial from a directory below a wordpress theme directory?
- Is there a way to switch to another theme?
- A post with a clear:both in its css destroy the theme design, and the sidebar is moved to the bottom
- New to WordPress – Read the Codex, Other Docs; Still Confused
- Adding content inside the anchor tags within WordPress main nav
- How add built-in textarea in theme development?
- Create theme for mobile phones and tablets only?
- Unwanted empty line at the beginning of document
- How to add custom page elements to the WYSIWYG editor?
- Remove h1 from 2015 theme
- Never actually adding the action? Or do I have to call the action?
- WordPress pulling in random page themes
- How to Emulate Default Navigation Menu Behaviour in a Custom Theme?
- best practices for updating wordpress theme