How To Disable Infinite Scroll Function Of PR News Theme Guide


Pr News theme has this function where the front page will continuously keep loading when you pull down the scroll bar on the right side of the screen.


The term is called infinite scroll or infinite scrolling. In order to make it a static page, you need to disable or remove the function that makes the front page loading continuously.

1. Go to WordPress Dashboard.

2. Look for Appearance and click on Editor.

3. Under the Templates list on the right, click  on function.php

4. Now look for this set of code:

<script type="text/javascript">
        jQuery(document).ready(function($) {
            var $container = $('#mcontainer');
            var pageNum = 1;
            $container.infinitescroll({
                navSelector : '#navigation',
                nextSelector : '#navigation #navigation-next a',
                itemSelector : '.boxy',
                maxPage       :20,
 loading: {
            msgText: '<?php _e('Loading', 'prpin') ?>',
            finishedMsg: '<?php _e('All items loaded', 'prpin') ?>',
            img: '<?php echo get_template_directory_uri(); ?>/img/loading.gif',   
    }
            },
            // trigger Masonry as a callback
            function(newElements) {
                // hide new items while they are loading
                var $newElems = $(newElements).css({opacity: 0});
                    pageNum++;
                // ensure that images load before adding to masonry layout
                $newElems.imagesLoaded(function() {
                    // show elems now they're ready
                    $newElems.animate({
                        opacity: 1});
                    $container.masonry('appended', $newElems, true);
                });
                onAfterLoaded($newElems);
                });
        });
    </script>


5. Delete it or you can comment it. It means to hide it by adding these two tags <!-- and --> at the beginning and the end of the code respectively. 

6. This is how it looks like.

<!-- <script type="text/javascript">
        jQuery(document).ready(function($) {
            var $container = $('#mcontainer');
            var pageNum = 1;
            $container.infinitescroll({
                navSelector : '#navigation',
                nextSelector : '#navigation #navigation-next a',
                itemSelector : '.boxy',
                maxPage       :20,
 loading: {
            msgText: '<?php _e('Loading', 'prpin') ?>',
            finishedMsg: '<?php _e('All items loaded', 'prpin') ?>',
            img: '<?php echo get_template_directory_uri(); ?>/img/loading.gif',   
    }
            },
            // trigger Masonry as a callback
            function(newElements) {
                // hide new items while they are loading
                var $newElems = $(newElements).css({opacity: 0});
                    pageNum++;
                // ensure that images load before adding to masonry layout
                $newElems.imagesLoaded(function() {
                    // show elems now they're ready
                    $newElems.animate({
                        opacity: 1});
                    $container.masonry('appended', $newElems, true);
                });
                onAfterLoaded($newElems);
                });
        });
    </script> -->


7. Click Update File.

Now you should have a static front page for your PR News theme.

By:Kher Cheng Guan

Blogspot And WordPress Help Tips, Updated at: 9:25 AM
Related Posts Plugin for WordPress, Blogger...