• Resolved esferapublica

    (@esferapublica)


    Hi,

    I’m using the sobeks posts in category plugin to show a list of all other posts in the same category next to my content.

    I used it like this:

    <ul>
      <?php
      $out = array();
      foreach((get_the_category()) as $category) {
      array_push($out,$category->cat_ID);
      }
      ?>   
    
      <?php sobeks_posts_in_category('sort:date',$out[0]) ; ?>
    </ul>

    I’m a total newby in php, so I hope that’s right. It actually works.

    But how can I modify this to highlight the current post in the list??
    I know that there is something like a current class, but I don’t know how to use it in this case. I would be really happy for any solution. I’m trying to figure this out since days.

    thx.* karen

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter esferapublica

    (@esferapublica)

    btw:

    the output of sobeks plugin is a simple list like:

    <ul>
    <li><a href="www.mydomain.com/?p=29">Intro</a></li>
    <li><a href="www.mydomain.com/?p=44">Aufgabenstellung</a></li>
    </ul>
    Thread Starter esferapublica

    (@esferapublica)

    ok, problem solved.

    i deactivated the plugin and it worked with code i found at another post.

    <ul>
      <?php
    
      $catsy = get_the_category();
      $myCat = $catsy[0]->cat_ID;
      $IDOutsideLoop = $post->ID;
      global $post;
      $myposts = get_posts('category='.$myCat);
      foreach($myposts as $post) :
      ?>
    
      <li <?php if($IDOutsideLoop == $post->ID) print 'class="current-cat";' ?>><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    
      <?php endforeach; ?>
    </ul>
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘sobeks posts in category plugin, highlight active post’ is closed to new replies.