Skip to content

Instantly share code, notes, and snippets.

@bepatrickdavid
Created August 4, 2015 07:33
Show Gist options
  • Save bepatrickdavid/461553b118294d8d89be to your computer and use it in GitHub Desktop.
Save bepatrickdavid/461553b118294d8d89be to your computer and use it in GitHub Desktop.
WP: bbPress from reply get forum ID dal reply prendere l'id del forum
<?php $args = array(
'post_type' => 'reply',
'post_status' => 'publish',
'posts_per_page' => 3,
'order' => 'DESC',
'orderby' => 'date'
);
$the_query = new WP_Query( $args ); ?>
<?php if ($the_query->have_posts()) : ?>
<?php while ($the_query->have_posts()) : $the_query->the_post(); ?>
<?php $parent = array_reverse(get_post_ancestors($post->ID));?>
<?php $forumID = $parent[0]; ?>
<?php endwhile ?>
<?php endif ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment