{"id":3456,"date":"2020-01-13T00:57:27","date_gmt":"2020-01-12T23:57:27","guid":{"rendered":"https:\/\/www.knowboard.de\/?p=3456"},"modified":"2020-01-13T01:52:17","modified_gmt":"2020-01-13T00:52:17","slug":"how-to-easly-enable-infinite-scroll-in-the-wordpress-total-theme-or-others","status":"publish","type":"post","link":"https:\/\/www.knowboard.de\/how-to-easly-enable-infinite-scroll-in-the-wordpress-total-theme-or-others\/","title":{"rendered":"How to easily enable „infinite Scroll“ in the WordPress Total Theme (or others)"},"content":{"rendered":"\n
It is really modern to use the infinite scroll effect, though I am not quite sure I I am really a fan of it. Whenever there are more posts available than you want to initially show on a page, you could use pagination or simple „infinite scroll“. So when the user scrolls to the bottom the next few posts will be loaded.<\/p>\n\n\n\n
Actually If you don’t have this functionality provided, as in the total theme where some Visual composer module slack this function, you can easily add it to any theme. It is as simple as dropping a few lines of code to the functions.php.<\/p>\n\n\n\n
Just add this code snippet with a script that auto triggers a click on a certain button element selected by jQuery. It works out of the box with the total theme but can be easily adapted for use with any theme but changing the button selector.<\/p>\n\n\n\n
add_action( 'wp_footer', function() { ?>\n <script>\n jQuery(function(){ \/\/on document ready\n jQuery(document).scroll(function (e) { \/\/bind scroll event\n\n var intBottomMargin = 300; \/\/Pixels from bottom when script should trigger\n\n \/\/if less than intBottomMargin px from bottom\n if (jQuery(window).scrollTop() >= jQuery(document).height() - jQuery(window).height() - intBottomMargin) {\n jQuery(\".vcex-loadmore a\").click(); \/\/trigger click\n }\n\n });\n});\n <\/script>\n<?php }, 99 );<\/pre>\n","protected":false},"excerpt":{"rendered":"It is really modern to use the infinite scroll effect, though I am not quite sure I I am really a fan of it. Whenever there are more posts available than you want to initially show on a page, you could use pagination or simple „infinite scroll“. So when the user scrolls to the bottom…<\/p>\n","protected":false},"author":1,"featured_media":3458,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-3456","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-allgemein","entry","has-media"],"_links":{"self":[{"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/posts\/3456","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/comments?post=3456"}],"version-history":[{"count":2,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/posts\/3456\/revisions"}],"predecessor-version":[{"id":3459,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/posts\/3456\/revisions\/3459"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/media\/3458"}],"wp:attachment":[{"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/media?parent=3456"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/categories?post=3456"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/tags?post=3456"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}