Forum Replies Created

Viewing 2 replies - 16 through 17 (of 17 total)
  • Hello ! can anyone help me whit “post_not_in” array ??

    I would to exclude the current category , but not the parent of current.

    this is the example:

    ?php $categories = get_the_category($post->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($post->ID),
    
            'showposts'=>5, // Corresponds to Number of related posts to be shown.
    
            'caller_get_posts'=>1
    
        );
    
     $my_query = new wp_query($args);
    
    if( $my_query->have_posts() ) {
    
    echo '<h2 class="related_post_title">OTHER VIDEOS FROM </h2><ul class="related_post">'; 
    
    while ($my_query->have_posts()) {
    
    $my_query->the_post();?> 
    
    <li><a href="<?php the_permalink() ?>"
    
    rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"> <img src="<?php echo get_post_meta($post->ID, "video_thumbnail", true); ?>" alt="<?php the_title(); ?>" /><?php the_title(); ?></a></li><?php }
    
    echo '</ul>'; } } $post = $backup; wp_reset_query(); ?>

    this is work right…but gets me the relative of category parent and not only the child!

    please help meee 🙂

    Hi, do you know if I can use it in a sidebar, for example only title of an event..in an order list?

    thankyou

Viewing 2 replies - 16 through 17 (of 17 total)