How to Add a Load More Messages Button in WordPress
Themes 2020-06-19 08:49:45
Do you want to add an additional message loading button in WordPress? Many popular platforms allow users to load more messages when they reach the bottom of the page. In this article, we will show you how to easily add an additional message loading button in WordPress.
plug-in. For more details, see our step-by-step guide on. Upon activation, the plugin will add a new menu item called "Ajax Load More " to your WordPress administration menu. You must click on it and go to the plugin settings page.
On the settings page, you can choose the color of your button, or you can replace the button with an infinite scroll that automatically loads the next batch of messages without users clicking the button. Next, you must visit the Ajax Load more Repeater model page to add your article display model. The plugin is supplied with a basic model containing the articles to display. However, it does not match your theme and may appear inappropriate on your website. To resolve this issue, you must copy the code that your theme uses to display articles on them. index, archive, and blog pages. Normally, this code is in the template-parts folder for your theme. In this folder, you will seetemplates to display different content. For example, content-page.php, content-search.php, and more. You will look for the generic template content.php. Here is an example of our d Content.php file from the emo theme: php // Post thumbnail. ", " "); else: the_title (sprintf ( " ", esc_url (get_perma ())), "
"); endif; php / * translators:% s: name of the current message * / the_content (sprintf (__ ( "Continue reading% s ", "twentyfifteen "), the_title ( " ", " ", false))); wp__pages (array ( "before " => " ". __ ( "Pages: " , "twenty-fifteen "). " ", "after " => " ", "_ before " => " ", "_ after "=> " ", " page "=> " ". __ ( "Page ", "twenty-fifteen "). "% ", "separator " => ", ",)); php // Bio author. if (is_single () && get_the_author_ ( "deion ")): get_template_part ( "author-bio "); end if; php twentyfifteen_entry_ php edit_post_ (__ ( "Edit ", "twentyfifteen "), " ", " "); Once you have found this code, you need to paste in the Repeater models field in the plugin settings. Do not forget to click on the "Save model " button to save your settings. Next, you need to visit the Ajax Load More Shortcode Builder page to generate the file. This page contains many different options that you can customize. You must first select the type of conteneur. If you are unsure, just look at the model you copied earlier. Most modern themes use the ; element. After that, scroll down to the button labels section. Here you can change the text that appears on the button. By default, the plug-in uses "Older items ", and you can change it to "Load more items " or whatever you want.
" style = "max- height: 400px; max-width: 99%; "> Finally, you must choose whether you want the publications to load automatically or wait for users to click on the load more messages button.
" style = "max- height: 400px; max-width: 99%; "> Your shortcode is now ready to use . In the right column, you will see the shortcodeproduction. Go ahead, copy the shortcode and paste it into a text editor as you will need it in the next step.
" style = "max- height: 400px; max-width: 99%; "> Adding more posts to your WordPress theme part of the tutorial will tell you requires adding code to your WordPress theme files. If you haven"t done so already, take a look at our guide. Remember to do this before bringing modifications. You will have to find the template files in which you want to add the button Load more messages in your theme. Depending on the organization of yourBeing themed, these files are generally index.php, archives.php, categories.php, etc. You will need to add the shortcode that you copied previously in your theme just after the end while; tag. Since we add the shortcode to a theme file, we will have to add it inside the do_shortcode function, like this: echo do_shortcode ( "[ajax_load_more container_type = " div "post_type = " post "] "); You can now save your changes and visit your website to see the "Load more messages " button in action.
We hope this article helped you Learn how to add the Load more messages button in WordPress. You can also consult our mega-list of beginners. If you liked this article, then subscribe to our WordPress video tutorials. You can also find us on and.