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
- Set template for custom post type?
- Load Next WordPress Posts With AJAX?
- How can I display the parts of custom posts?
- How do I display a list showing custom post types nested within a taxonomy?
- Custom Post Type & Custom Menu Walker to append custom class for active post types
- Dynamically output a class to an anchor tag depending on what tag is chosen
- How can I add a custom field to an existing custom post type?
- Add a custom meta box for client to order CPT posts how they want
- Custom posts type for individual pages?
- Help With Warning on creating new Post types?
- Custom select query for taxonomies that have posts categorized in another taxonomy
- help
- Why won’t this jQuery code work?
- Custom post type’s extra fields – how to handle?
- Is there a way to exclude posts based on meta_values?
- What is the ID parameter for custom post types in query_posts?
- Loop for custom post types filtered by a taxonomy
- Number of posts in the archive
- custom post data – how to
- calling categories in a custom post type
- Custom post_type search pages
- Ordering Submenu Pages in WP 3.1
- How can i link a custom post type thumbnail to intermediate size
- Including link to custom post type in ‘wp_list_pages’ function