Custom post type relacionados ayuda

Mensajes
78
Puntuación de reacción
0
Hola estoy queriendo poner notas relacionados a un custom post type perzonalido pero solo me funciona en post algun codigo o ayuda tengo esto.


<?php
$categories = get_the_category(get_the_ID() );

if ($categories) {
$category_ids = array();
foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;

$args=array(
'category__in' => $category_ids,
'post__not_in' => array(get_the_ID()),
'showposts'=>4, // Number of related posts that will be shown.
'caller_get_posts'=>1

);

$my_query = new wp_query($args);
?>

<?php
if( $my_query->have_posts() ) {
echo '<ul>';
while ($my_query->have_posts()) {
$my_query->the_post();
?>

<li class="post-rel">
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a><br>

</a>
</li>
<?php
}
echo '</ul>';
}
}
wp_reset_query();
?>
 
Arriba