• My Blog page has content and posts, but i want to show posts loop not content on AMP. I did changes in page.php.

    <?php if(is_page(651)){ ?>
    <?php amp_loop_template(); ?>
    <?php }else{
    amp_content();
    } ?>

    But this is not working and did’t show any post.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor ampforwp

    (@ampforwp)

    Hi @meetsohail,

    Have you also have the loop.php file in the same structure? Will you please follow this tutorial for adding the loop – https://ampforwp.com/tutorials/article/loop/

    Please follow this and let us know.

    Thread Starter meetsohail

    (@meetsohail)

    Hello @ampforwp,

    Thank you for your response. I am using “Swift” theme for AMP and loop.php file exists in the same structure.

    I have also tried to code within page.php file but still no result.

    <?php 
    if(is_page(651)){
        $width  = 346;
        $height = 188;
        if( true == $redux_builder_amp['ampforwp-homepage-posts-image-modify-size'] ){
            $width  = $redux_builder_amp['ampforwp-swift-homepage-posts-width'];
            $height = $redux_builder_amp['ampforwp-swift-homepage-posts-height'];
        } ?>
        <?php //while(amp_loop('start')): ?>
        <div class="fsp">
            <?php if(ampforwp_has_post_thumbnail()){ $args = array("tag"=>'div',"tag_class"=>'image-container','image_size'=>'full','image_crop'=>'true','image_crop_width'=>$width,'image_crop_height'=>$height, 'responsive'=> true); ?>
            <div class="fsp-img">
                <?php amp_loop_image($args); ?>
                </div><?php } ?>
                <div class="fsp-cnt">
                    <?php amp_loop_category(); ?>
                    <?php amp_loop_title(); ?>
                    <?php if( ampforwp_check_excerpt() ) { amp_loop_excerpt(20); } ?>
                    <div class="pt-dt">
                        <?php amp_loop_date(); ?>
                    </div>
                </div>
            </div>
            <?php //endwhile; amp_loop('end');  ?>
            <?php
        }else{
            amp_content(); 
        }  
    • This reply was modified 6 years, 1 month ago by meetsohail.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘amp_loop_template() is not working in specific page’ is closed to new replies.