GithubHelp home page GithubHelp logo

dhingal / wordpress-ajax-load-more Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alexcavender/wordpress-ajax-load-more

0.0 0.0 0.0 27 KB

Load more blog posts with AJAX in WordPress

License: GNU General Public License v3.0

PHP 100.00%

wordpress-ajax-load-more's Introduction

What is this?

This snippet lets you load more blog posts with AJAX in WordPress.

Setup

  1. Add the function inside functions.php to the bottom of your theme's functions.php file
  2. Add the code from index.php to your theme's index.php , directly before <?php get_footer(); ?>

How to Edit the number of posts loaded

By default , the snippet gets the next 10 posts

What if your blog is set up to load 5 of your latest posts?

  1. In the function load_more_posts, change 'posts_per_page' from 10 to 5
  2. In your index.php, inside <script> change offset from 10 to 5, and on line 26 change 10 to 5.

How do I style the blog posts that are loaded?

  1. Everything inside the <article> tag within functions.php can be customized (lines 24-32) Examples include grabbing the post thumbnail via the_post_thumbnail() or any wordpress template tags one would traditionally use.

Will this work with my theme?

  1. This should work with any WordPress theme. Of course, there will be exceptions especially on large themes that have lots of custom code. It has been designed to work out of the box with any underscores based theme.

wordpress-ajax-load-more's People

Contributors

alexcavender avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.