There are several ways to do this. Unless you are only going to have a few posts of type ‘section1’ then I would advise against listing them all.
Options:
- WP_Query
- get_posts() (Actually uses the WP_Query object anyway!)
Using the WP_Query() option:
<?php $posts = new WP_Query( array( 'post_type' => 'section1', 'posts_per_page' => -1 ) ); ?>
<ul>
<?php while( $posts->have_posts() ) : $posts->the_post(); ?>
<li><a href="https://wordpress.stackexchange.com/questions/42325/<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>
</ul>
<?php wp_reset_postdata(); ?>
Hope that helps!
If you are looking to dynamically create a nav-menu from the posts of a specific category, let’s say having the slug ‘featured’, then replace ‘post_type’ => ‘section1’ with ‘category_name’ => ‘featured’
Related Posts:
- Remove current_page_parent nav class from blog index when in CPT
- How To Remove These Stuffs From Custom Post Type List Screen?
- WordPress Custom Post Types with a page as a parent?
- How to order adjacent posts (prev / next) by custom field value?
- How to model a hierarchy for courses, levels and lessons?
- How make get_next_post() return first post when viewing last one
- Problem excluding category from get_next_post
- specify meta_key / meta_value condition for prev_post_link and next_post_link
- taxonomy list display custom post count
- Full-Ajax Theme: parseJSON error while building a JSON object from a WordPress custom template
- posts_nav_link on single post template
- Dropdown list of a custom post type
- Highlight nav menu terms
- Custom Taxonomy Breadcrumb Navigation
- wp_list_pages doesn’t work in hierarchical custom post type
- Select menu should display categories and the item’s depth
- Why are navigation items saved in the database?
- adding .current* tags to custom post types and taxonomies
- wp_get_nav_menu_items wp-admin/customize.php problem
- current-menu-item not working with custom post type
- Showing Custom Content in a Nav Dropdown
- Hierarchical Custom Posts – Highlighting Current Post in Sub-Menu
- How to create A-Z index listing for custom post types?
- Custom Post Type Navigation on Custom Field
- Add/Remove current_page_parent class
- Twenty Fifteen: Adjacent posts by menu_order [duplicate]
- How can i change the output of posts_nav_link();
- How to convert custom post type based list to a dropdown list?
- Creating a navigation menu of all posts of a custom post type and their children posts?
- wordpress wp_list_pages help
- Showing up my custom post type in primary navigation
- Paging doesn’t work?
- Hide post navigation if current post is in a category with only one post
- A to Z List of Custom Post Type in three columns
- How To Show All Custom Post Types In A Category Instead Of Pagination?
- Losing Nav Active State in Menu
- Custom Post Types in the WordPress Navigation Menu
- How can i automatically add CPT single pages as sub menu items
- How does the ‘the_post_navigation()’ work for CPT’s?
- List of all entries of custom-post-type: Add year-parameter?
- Displaying Custom Posts
- List All Custom Post Types Posts in Nav Menu Dynamically
- New posts label category with “new”
- Can’t Get Parent and Child Categories of Custom Taxonomy to Display
- Previous / Next Links For Custom Post Type Sorted By Meta_Value
- Include “Scheduled” (“Future”) Posts in WordPress Post Navigation ( previous_post_link, next_post_link ) for a Specific Custom Post Type
- How to get next post link of child custom post type from parent post and get next post link of parent post from the last child post?
- Manually adding current_page_parent to wp_list_pages()
- Prev/Next Navigation on Single Post Disappeared for Custom Post Type
- How to create a Child & Siblings menu for a custom post type?
- current-post-parent for custom post type
- put a list of one post type in other post type to select from it and display selected item in second post type’s single page
- Adding a nav menu for a custom post type
- Insert a hash into the url of custom posts to make them function as anchors
- Post navigation doesn’t show (in custom template, custom post type, custom query)
- Navigation not working for custom post type pages
- wp_nav_menu doesn’t seem to work on custom post type pages
- Custom nav menu current item custom link problem
- Listing Custom Post Post from certain category
- Calling the first & last post by category in custom post type
- Simple term-archive-linked Taxonomy Entry output
- Programmatically Split A Post Into Multiple Pages
- List a custom post type’s posts ordered by nested custom taxonomy
- Create shortcode for list of custom post titles with custom fields alongside
- next_posts_link returns same content of 1st page
- Custom post type navigation – 404 on page 2
- Split custom post list into two columns
- How to make a list of posts displaying them 5 by 5 with a “next posts” link?
- How to Create a Frontend Html-list Editable in the Backend?
- current_page_item and custom post type?
- Why is Posts page selected when showing single Custom Post Type?
- add a “list” into add meta box : problem
- Navigation links to posts in current term shortcode
- Pagination for Custom Post Type with Multiple Types
- Navigation won’t update to show full path to single post
- get_the_post_navigation not working
- Number of pages – multiple (custom) post types
- Limit widget to a specific registered sidebar
- Hook when adding or editing a specific custom post type? [closed]
- can register_post_type() be safely called before init
- Display two post types ordered by two custom fields
- Change / Delete the default post type and category?
- Registering post type is not adding to admin menu
- Pagination is not working on single-{slug}.php but works fine on page-{slug}.php
- Add an option in a builder
- What is the best way to correlate one-to-many content-type relationships?
- Is there a conditional tag to determine whether the post is _any_ custom post type?
- Single template showing all posts of that type
- How can you use one database with multisite
- Including link to custom post type in ‘wp_list_pages’ function
- Creating tags via API
- Select2 AJAX and WP Query Returns ALL and does not filter
- Reusable metabox backend and frontend
- How to loop through custom post type items and add them to a slider if they exist
- Use Gravity Forms and a Shopping Cart for output to Freshbooks for an Estimate [closed]
- Add custom posts to submenu automatically
- Custom post categories are not displaying on the page
- Get posts under custom taxonomy and custom post type
- How to Associate Posts with Pages
- What is the code for showing Custom Category and Subcategory Page?