Welcome to PressWork!

Want to ask a question or join the discussion? Great! Join now.

In this Discussion

  • Is it possible to implement a global integer var in the loop which increments with the count of posts in the loop? I could then check it in the custom action for displaying posts and add some content at i.e. the second or third post and leave the others untouched. (Maybe like odd/even var?)
    This question is for general use in the framework, as I know to do it with a child theme and re-code the loop. I'd like to be update-save and only use my custom actions...
    Thanks, Markus
  • cbavotacbavota
    This answer was Accepted.
    There already is a "odd" and "even" class added to each post so you can play off of that.
    image Senior Developer & Co-Founder of PressWork
  • Thanks, I knew that, but it didn't work for me.
    I now made it with a global var in custom-actions.php.
    <?php
    $post_count = 0;
    function my_posts() {
    global $post_count;
    $post_count++;
    ...
    }
    ?>

    What I learnd: keep thinking simple ;-)
    I love this framework! Cheers m.