I accidentally got the answer:
<?php
global $post;
$the_post_parent = $post->post_parent;
$the_post_ID = $post->ID;
$cat_posts = get_posts('post_type=bbp_forum&posts_per_page=-1');
print_r($post_parent);
?>
<?php foreach ( $cat_posts as $post ) : ?>
<li <?php if ( $post->ID == $the_post_ID || $post->ID == $the_post_parent ) echo 'class="current"'; ?>>
<a href="https://wordpress.stackexchange.com/questions/13966/<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
</li>
<?php endforeach; ?>
I would appreciate if someone explain it to me.
Related Posts:
- BBPress Search results in WordPress search
- how to use custom post types collectively integrated with each other
- Query for bbPress replies to current topic?
- Custom Post Types and Posts are mixed
- get all posts from a custom post type
- Set post date before 1970
- Single loop for wp_query and wp_user_query
- query multiple taxonomies
- wp_set_object_terms() is not replacing term, but creating a new one
- Create an archive page for custom taxonomies
- Using custom field as custom post title
- How to check if last uri segment is a custom post type or taxonomy term?
- Pass parameter to custom post type single while keeping clean url
- Pagination Doesn’t Work
- filter search result with custom post type meta key
- When you create a custom post type, does that also create capabilities for editing/deleting that post type automatically?
- Cleanest way to code “Custom Write Panels/Meta Boxes”?
- Add an A-Z menu at the top of A-Z listing code
- Automatically check “Allow comments” for custom post type [duplicate]
- Trying to manage templates on a blog with lots of custom taxonomies
- How to register custom post types in a plugin?
- Actions that Run on Admin Edit Page Load After Posts Are Queried
- Having trouble with custom date field for CPT query (WordPress)
- How to retrieve custom field types for all posts in WordPress/PHP?
- Separate Posts and Custom Post Type in Custom Taxonomy archive template
- Need functionality with all post list available at edit.php
- Add custom capabilities to existing custom post type
- Custom Post Type Post have a Child `Page` Post Type Post
- Use get_post_types to query only custom posts types
- pre_get_posts on custom post type
- How to duplicate fields in custom post types?
- Send email button in custom post type backend
- add category name to permalinks on product page /category-name/product-name
- create parent post using wp_insert_post
- Exclude pages in archives results
- current post index within content.php
- create a new page from a custom post type similar to an authors page
- Auto Complete Search
- Can multiple authors be assigned on a single custom post?
- How to display custom post in archive section of the wordpress page?
- Displaying Custom Taxonomies From Multiple Custom Post Types
- Not getting posts of custom post types
- Custom post type pages return 404 page?
- Filter date from post meta when date is in string format
- Properly flush rewrite rules on plugin activation
- Send a conditional email notification when a custom field value changes in Post Type
- Check for a specific taxonomy of a custom post type
- Add custom CSS class to custom post type
- Dynamic bootstrap tabs with post_title doesn’t display the_content
- portfolio custom type tags support
- WordPress Custom Post Type – Rewrite Query
- Custom post type suddenly stoped working after WordPress 5 update
- Custom post type to lead to single post type instead of shortcode modal
- is_main_query() never called on WP 4.4
- Change post type depending on shortcode
- Redirect User From Registration Page To CPT (profile page) with custom url
- Set Default Option Value as Blank for Meta Box
- Query Posts, order by meta value
- Admin: Get all user for Custom Role
- How to add a class to meta boxes (to customize them in CSS)?
- custom post types missing ADD NEW
- Custom post type menu button color
- adding page types in menu
- wp3 custom post types rss
- Drop down list with posts within the “add new” page
- Custom taxonomy not saving correctly
- How to have multiple archive pages?
- Custom post type permalink structure to include the taxonomy
- Custom Post Type Rewrite Throws Headers Sent Errors
- How can I sort the order of multiple custom field values in a custom post type?
- Extending post by email
- I want to rewrite the URL of a specific post with a specific custom field to easily analyze in Google Analytics
- Custom taxonomy does not display in custom post loop
- CPT email notification including only new value custom fields
- Return multiples taxonomies with wp_get_object_terms
- Button per line in Custom Post Types
- Change display of product price on product show page only
- CPTUI rewrite disable when no post in CPTUI has been found
- Save_post acf data not updating category of post type
- Looping to organize and display custom posts by category using PHP and WordPress
- Dupplication of Custom Post Type while adding attachment
- I have a problem with displaying children pages of custom post type
- How to properly set a value to meta fields of a custom post type in WP-API/node-wpapi REST API?
- Infinite scroll doesnt work
- When post is Published, insert into custom table a number – custom post type
- Pagination URL in Custom Content Type
- Is it possible to add a cpt that can only be viewed in backend, not edited?
- Customize url from the_terms
- How do I put `tax_query` in this WP_query?
- Can’t use orderby in WP_Query
- How to display elements of different post types?
- Multisite – Echo admins profile meta
- display post types alternately
- Creating additional page with own URL for each custom post
- exclude posts from a custom category
- Problem with Custom Post Types, Taxonomy, permalink, Archive
- Only One Post of Custom Post Type Appearing on Template Page
- WPNavi pagination links not working on custom pages
- Rewrite Rule for custom post type link with or without taxonomy terms
- How to add to taxonomies to a post type