• Resolved wpnh

    (@wpnh)


    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 3 years, 10 months ago by wpnh.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Darren Cooney

    (@dcooney)

    @wpnh what code is this? And how can I test it.

    Thread Starter wpnh

    (@wpnh)

    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 3 years, 10 months ago by wpnh.
    Plugin Author Darren Cooney

    (@dcooney)

    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/

    Thread Starter wpnh

    (@wpnh)

    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

    (@wpnh)

    great. Didn′t know there is a $alm_current. Works with it. Thank you ??

    Plugin Author Darren Cooney

    (@dcooney)

    Nice! ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘incrementing php value (++) not working after update’ is closed to new replies.