Title: incrementing php value (++) not working after update
Last modified: January 5, 2021

---

# incrementing php value (++) not working after update

 *  Resolved [wpnh](https://wordpress.org/support/users/wpnh/)
 * (@wpnh)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/incrementing-php-value-not-working-after-update/)
 * Hello, after update to your newest version, the PHP incrementation is not working
   in the repeater template.
 *     ```
       $countclass = 1;
   
       <div class="b_overview_item b_ov_item_<?php echo $countclass++; ?>"> 
       ```
   
 * The whole code is this:
 *     ```
       <?php
       $countclass = 1;
       $countclass_wrap = 1;
       ?>
       <?php foreach((get_the_category()) as $category) { 
                        $catoname = $category->cat_name; 
                       };
               ?>        
               <?php  
   
                   $bn_badge_name = get_field( "bn_badge_name" );
                   $bn_offer_until_date = get_field( "bn_offer_until_date" );
                   $bn_special_offer_link = get_field( "bn_special_offer_link" );
               ?>
               <div class="b_overview_itemwrap _<?php echo strtolower($catoname);?> b_ov_wrapitem_<?php echo $countclass_wrap++; ?>">
                   <div class="b_overview_item b_ov_item_<?php echo $countclass++; ?>">
                       <div class="b_overview_logo">
                           <?php if($bn_offer_until_date !=""): ?>
                               <div class="b_overview_date"><i class="fa fa-calendar" aria-hidden="true"></i> <?php echo $bn_offer_until_date;?></div>
                           <?php endif;?>
                           <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><img src="<?php if($countclass ==1){
               the_post_thumbnail_url("large");
               }else{the_post_thumbnail_url("medium");}?>" alt="<?php echo get_post_meta( get_post_thumbnail_id(), '_wp_attachment_image_alt', true );?>"/></a>
                       </div>
                       <div class="title_link_wrap">
                           <div class="b_overview_title">
                               <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
                           </div> 
                            <?php if ($countclass == 1):?>
                           <span class="b_excerpt"><?php the_excerpt();?></span>
                           <?php endif;?>
                           <div class="b_overview_linkbar">
                               <div class="b_overview_links">
                                   <a class="b_infos" href="<?php the_permalink(); ?>">MORE</a>
                                   <?php if($bn_special_offer_link !=""): ?>
                                       <a href="<?php echo $bn_special_offer_link;?>" class="b_ext" target="_blank" rel="nofollow">GET OFFER <i class="fa fa-chevron-right" aria-hidden="true"></i></a>
                                   <?php endif;?>
                               </div>                    
                           </div>
                       </div><div class="clear"></div> 
                   </div> 
               </div>
       ```
   
 * Do you know how to make it work again, please?
 * Thanks, Nico
    -  This topic was modified 5 years, 4 months ago by [wpnh](https://wordpress.org/support/users/wpnh/).

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/incrementing-php-value-not-working-after-update/#post-13866665)
 * [@wpnh](https://wordpress.org/support/users/wpnh/) what code is this? And how
   can I test it.
 *  Thread Starter [wpnh](https://wordpress.org/support/users/wpnh/)
 * (@wpnh)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/incrementing-php-value-not-working-after-update/#post-13867053)
 * i´ve used the old plugin version for now. That works. maybe in later releases
   this bug will be fixed. But thanks.
 * Short summary
    - Shortcode (in functions.php) includes php file xy
    - file xy has code:
 *     ```
       <?php
       $countclass = 1;
       $countclass_wrap = 1;
       ?>
       <article class="bookienews_overview">
           <div class="b_news_smallfilter">
               <span class="bn_left"><?php echo get_field('sports_betting_news_translation', 'options');?></span>
           </div>
           <div class="bookie_overview_wrap">
   
               <?php echo do_shortcode('
       [ajax_load_more container_type="div" post_type="post" posts_per_page="13" category="'. $category_slug .'" scroll="false" button_label="'. $loadmore_name .'" button_loading_label="Loading"]
       ');?>
   
           </div>
       </article>
       ```
   
    - Repeater template is above (the large code)
    - echo $countclass++; not working
 * Thats all. In Version: 5.4.2 it works well.
    Bye, Nico
    -  This reply was modified 5 years, 4 months ago by [wpnh](https://wordpress.org/support/users/wpnh/).
 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/incrementing-php-value-not-working-after-update/#post-13867064)
 * I changed the include method, so that could be why.
    You could maybe use ALM 
   Variables instead. [https://connekthq.com/plugins/ajax-load-more/docs/variables/](https://connekthq.com/plugins/ajax-load-more/docs/variables/)
 *  Thread Starter [wpnh](https://wordpress.org/support/users/wpnh/)
 * (@wpnh)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/incrementing-php-value-not-working-after-update/#post-13867072)
 * the large code here (the first example i´ve posted had the vars $countclass =
   1;
    $countclass_wrap = 1; only for testing. This is the code here:
 *     ```
       <?php foreach((get_the_category()) as $category) { 
                        $catoname = $category->cat_name; 
                       };
               ?>        
               <?php  
   
                   $bn_badge_name = get_field( "bn_badge_name" );
                   $bn_offer_until_date = get_field( "bn_offer_until_date" );
                   $bn_special_offer_link = get_field( "bn_special_offer_link" );
               ?>
               <div class="b_overview_itemwrap _<?php echo strtolower($catoname);?> b_ov_wrapitem_<?php echo $countclass_wrap++; ?>">
                   <div class="b_overview_item b_ov_item_<?php echo $countclass++; ?>">
                       <div class="b_overview_logo">
                           <?php if($bn_offer_until_date !=""): ?>
                               <div class="b_overview_date"><i class="fa fa-calendar" aria-hidden="true"></i> <?php echo $bn_offer_until_date;?></div>
                           <?php endif;?>
                           <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><img src="<?php if($countclass ==1){
               the_post_thumbnail_url("large");
               }else{the_post_thumbnail_url("medium");}?>" alt="<?php echo get_post_meta( get_post_thumbnail_id(), '_wp_attachment_image_alt', true );?>"/></a>
                       </div>
                       <div class="title_link_wrap">
                           <div class="b_overview_title">
                               <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
                           </div> 
                            <?php if ($countclass == 1):?>
                           <span class="b_excerpt"><?php the_excerpt();?></span>
                           <?php endif;?>
                           <div class="b_overview_linkbar">
                               <div class="b_overview_links">
                                   <a class="b_infos" href="<?php the_permalink(); ?>">MORE</a>
                                   <?php if($bn_special_offer_link !=""): ?>
                                       <a href="<?php echo $bn_special_offer_link;?>" class="b_ext" target="_blank" rel="nofollow">GET OFFER <i class="fa fa-chevron-right" aria-hidden="true"></i></a>
                                   <?php endif;?>
                               </div>                    
                           </div>
                       </div><div class="clear"></div> 
                   </div> 
               </div>
       ```
   
 *  Thread Starter [wpnh](https://wordpress.org/support/users/wpnh/)
 * (@wpnh)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/incrementing-php-value-not-working-after-update/#post-13867217)
 * great. Didn´t know there is a $alm_current. Works with it. Thank you 🙂
 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/incrementing-php-value-not-working-after-update/#post-13867227)
 * Nice! 🙂

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘incrementing php value (++) not working after update’ is closed to new
replies.

 * ![](https://ps.w.org/ajax-load-more/assets/icon-256x256.png?rev=2944639)
 * [Ajax Load More – Infinite Scroll, Load More, & Lazy Load](https://wordpress.org/plugins/ajax-load-more/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ajax-load-more/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ajax-load-more/)
 * [Active Topics](https://wordpress.org/support/plugin/ajax-load-more/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ajax-load-more/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ajax-load-more/reviews/)

## Tags

 * [increment](https://wordpress.org/support/topic-tag/increment/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 6 replies
 * 2 participants
 * Last reply from: [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * Last activity: [5 years, 4 months ago](https://wordpress.org/support/topic/incrementing-php-value-not-working-after-update/#post-13867227)
 * Status: resolved