I was making a beginner’s mistake. I was not defining the global variable post. I publish my complete code for the community. May be useful for something like me.
<?php
add_action( 'genesis_after_entry', 'capitulos_curso' );
function capitulos_curso(){
global $post;
$args = array(
'post_type' => 'curso',
'posts_per_page' => -1,
'post_parent' => $post->ID,
'order' => 'ASC',
'orderby' => 'menu_order'
);
$parent = new WP_Query( $args );
?>
<?php if ( $parent->have_posts() ) : ?>
<ul class="parent-page">
<?php while ( $parent->have_posts() ) : $parent->the_post(); ?>
<li><a href="https://wordpress.stackexchange.com/questions/307989/<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
</ul>
<?php endwhile; ?>
<?php endif; wp_reset_postdata();} ?>
<?php
genesis();
Related Posts:
- WordPress Genesis custom taxonomy archive shows 3 repeats of each post
- Custom Post Type Loop throws 500 error when used in widget
- Move Genesis Single Page/Single Post Title
- Custom Sidebar in Editor (not Widget) for Custom Post Type in Genesis
- If/Else child list for Custom Post Type single template within loop?
- Get Custom post with ID
- Custom Post Type Permalink For Parent/Child, 404 Page Not Found Error
- WP_Query to loop a Custom Field, Custom Post Types do not show
- Posts in Multiple Columns and Rows with one single loop
- Display posts of custom type in hierarchical order
- Alphabetical sorting of custom post type – one letter per page
- List all posts in Custom Post Type but group dynamically by Custom Taxonomies
- How to show posts from multiple post types in a single loop? And display them separately on the same template
- How to display the rest of categories on Portfolio filterable
- Get_post_meta() won’t return value
- Query Custom Post by Category
- How to get current post id of a custom post type in a loop using template singel-{custom type}.php?
- Query in a Hierarchical Custom Post Type for Children vs Siblings
- ‘category__and’ for custom taxonomy?
- WP_Query and using a variable for ‘cat’=> in the args array = WP Bug?
- Separate Posts and Custom Post Type in Custom Taxonomy archive template
- Custom post type hierarchical permalinks not behaving as expected for parent/child pages
- get_template_part for custom post type content not working
- Creating Accordians in WordPress Theme
- Can I make WordPress use a custom template for a child page
- How to insert content from another Custom Post type into Post?
- Display different content on homepage depending on post type
- How i can add ‘N’ page of ‘N’ pages under posts loop?
- WP_Query orderby modified to include custom meta changes
- get_attached_media() on author page not working
- Calculate all custom field values in the post loop
- I would like to have different styles for my posts based on the content of each post
- Checking if Post Title is Unique as Loop Criteria
- Custom post type multiple loop by taxonomy term
- List custom taxonomy specific to one custom post type
- Custom post type, organized by categories
- What’s the WP way to load remaining custom posts?
- What to and how to proceed with CPT to make DB small and efficient?
- Versioned Custom Post Type (Not the same as revisions)
- A custom post within a custom post
- Custom post Type, child of a Page?
- get_the_title() is returning results from previous loop
- How can I group posts by months and years?
- Trying to Create a PHP Variable for post_type that can be referenced Site Wide
- 3 random images from custom post type, each in a div with a diffrent class
- Displaying multiple post types on home page
- Shortcode leaves no space for other elements?
- Add more than one custom post type to wordpress home page post loop
- Custom wordpress loop
- Trying to add a class to post links
- Can’t replace the default sidebar with a custom sidebar on Custom Post Type in Genesis
- Use post in multiple places on a page with multiple posts
- List all Custom Post Type posts excluding certain Taxnomy term
- Loop and add Specific Categories and Products Images
- How can I increase the post count for custom post types only?
- Custom post type pagination error
- Add custom post type to query
- posts_per_page in custom WP_Query does not override “Reading” settings?
- Custom post type paging return home page
- when looping through custom post data not appearing
- Order posts alphabetically with numbers but some of the posts has numbers in the title
- Multiple Loops In Tabs Only Displaying First Loop
- How to only get the content of post page while looping?
- SEARCH QUERIES – REVERSE OUTPUT
- ACF meta_key and meta_value break loop
- post_type incorrect for custom post type
- Skip latest 3 posts from loop
- Staggering featured post using ‘sticky’
- Multiple Custom Post Type in Taxonomy Archive Causing White Screen
- Adding a Section for Visitors
- Why is my loop not populating the page with my custom taxonomy terms from my custom post type?
- Show parent category and subcategory once in while loop
- How to build Custom Post Nav Menu inside of the Loop
- Loop to display parent categories in custom taxonomy
- Sort loop by custom field from different post type
- next_posts_link() always generates second page link on custom post type
- Display related post content and custom field content
- Show posts for current taxonomy
- WordPress loop, show only one post per custom field
- How To Loop Through list with Custom Post Types
- How to Fix Custom WordPress Loop with Pagination on Single Post View?
- Multiple loops for custom post type to spread data across rows
- Different read-more link for each custom post type [closed]
- Custom Post Type + Category archive
- Loop multiple taxonomy in custom post
- $post breaking container loop
- Custom Post Type Child Pages
- Posts without featured image using other post’s featured image
- Get result from Custom Field in Custom Post type
- WordPress URL Problems and Layout
- Nested loop called with shortcode duplicating the content above the main loop
- Custom post-type’s pagination not working in category.php
- Pulling in a particular post into a single page based on the post id passed into the code
- why get_post_meta is returning 0?
- Get Posts From A Certain Post Type In An ID Array
- Show search for data extracted from metabox
- How to display custom message for (Genesis) featured posts if no posts
- Get all active posts that are tied to a custom taxonomy for a custom post type
- WPNavi pagination links not working on custom pages
- Group search results by post type, but having a unique heading for each section?