Working on a basic personal blog theme: should I get the blogs and render everything using PHP and serve to the user, or should I serve an empty div and then fetch the blogs using JS and the WP REST API? What do you recommend?

[ad_1]

Hi

So this question just crossed my mind because I’m creating a very basic personal blog theme. Should I use the built-in WP PHP functions to get the blogs and then serve the final design and everything to the user, or should I serve an empty div element to the user, and then use JS to make an API request to fetch the data and render into the empty div element (similar to React0?

I think it’s best to use PHP since using JS means making 2 requests to the server instead of 1, and also in PHP, I can use the i18n functions and all the other PHP/WP functions to manipulate data before outputting.

What do you think? Thanks

[ad_2]
1 Comment

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer