content of the page is not displaying getting empty page [closed]
The function is called the_post() (no plural s).
The function is called the_post() (no plural s).
Note that simply bootstrapping directly for a one off temporary file is never the optimal solution, and bad practice, and tends to introduce lots of problems. E.g. in your case, you might have WordPress functions available, but no theme files or APIs are triggered. Instead, there are better ways to do it. This isn’t considered … Read more
Exploiting WordPress Core Functionality for Development
Which position is after `wp-load.php`?
Ok, I’ve fixed it. Turns out that there was a php class name that was getting redeclared. Declared once in the theme, and once in the plugin.
I’d use the REST API to get the latest 10 posts from each install, then combine the two arrays, sort them by the date, and then only use the latest 10 results. $editorials = wp_remote_get( ‘https://www.example.com/editorials/wp-json/wp/v2/posts/’ ); $news = wp_remote_get( ‘https://www.example.com/news/wp-json/wp/v2/posts/’ ); $editorials = json_decode( $editorials[ ‘body’ ] ); $news = json_decode( $news[ ‘body’ ] … Read more
Here was the fix supplied by Flywheel support. They went above and beyond to help me figure this out. Amazing! <?php // let’s load WordPress require_once(ABSPATH . ‘wp-load.php’); require_once(ABSPATH . ‘wp-admin/includes/admin.php’); //send_nosniff_header(); nxs_ajax_webmethods(); die(); ?>
You should be using admin-ajax.php for your AJAX requests and WordPress has pretty good wrappers and actions to help you do that. In terms of performance, 3-4s is pretty harsh. WordPress will typically serve a non-cached request in about 300ms out of the box, so some other theme or plugin is adding to that time, … Read more
You don’t need to load wp-load.php, you can build an endpoint to poll with javascript using a REST API endpoint. In your plugin, or functions.php, we’re going to create an example endpoint, it will live at https://yoursite.com/wp-json/yourname/v1/yourendpoint, it will take in parameters, and reply with a snippet of JSON, just as you would expect from … Read more
If WordPress is installed in /subfolder/, then the authentication cookies will by default only valid for that path. So if needed, you can allow the cookies in parent directory by setting the cookie constants like COOKIEPATH. For example, if I had WordPress installed at example.com/wp/ and I wanted the authentication works at example.com/, then I’d … Read more