Perhaps you could consider using WP REST API to get the posts with a XMLHttpRequest in javascript instead of trying to get php work on .html file(s).
From the REST handbook,
The WordPress REST API provides an interface for applications to
interact with your WordPress site by sending and receiving data as
JSON (JavaScript Object Notation) objects.
And
It provides data access to the content of your site, and implements
the same authentication restrictions — content that is public on your
site is generally publicly accessible via the REST API, while private
content, password-protected content, internal users, custom post
types, and metadata is only available with authentication or if you
specifically set it to be so.
Related Posts:
- Missing sidebar parameter “fix” – before_content
- Widget back end radio button issue
- Current WordPress Page Title as Search Parameter into A Tag
- start_lvl Ignored in Custom walker_nav_menu
- How do I use Shortcodes inside of HTML tags?
- How display widget by id
- What exactly does “Posts page” do in WordPress?
- Adding a search form inside a div
- WordPress Shortcode and Dynamic CSS
- Load custom field value into div with AJAX
- Blank on static home page?
- How to use a frontend URL with a Plugin
- display most popular tags in two columns
- How to display blog images using wordpress in existing project
- How to display a value from a radio button in the options menu in wordpress
- Custom image upload
- How to display recent posts on home page with custom HTML
- Add before_content and after_content to register_sidebar
- WordPress automatically adds tags when pasting code, how to stop it?
- Slide in Panel WordPress Post
- Upload Image in a WordPress page using PHP
- Transferring working local PHP site to wordpress – with database (MySQL)
- My form action url is being prepended with a directory that does not exists
- Using the echo command adds unwanted br tags to source
- custom fields wordpress
- Why the JavaScript code is ignored from wp editor?
- Populate dropdown with Child Pages based on Parent Page chosen
- How to change redirection route to a php page for making it only accessible by logged-in members?
- Why Won’t My Inputs in a form with a Get method work together?
- How to get the value of input hidden html from text editor to custom page template?
- Why my image upload button is not working in wordpress widget area?
- How to determine if the sidebar is empty? Or not active?
- Hide HTML element (by class or ID) with PHP
- Is it bad to add html to a widget by closing and reopening the php tags?
- Path for php file for inserting data through html form
- How to remove coupon dropdown feature
- Add shortcode in my div
- Add html link in functions.php files of the theme
- Handling PHP/HTML inside the output of a shortcode function
- Illegal string offset error in wordpress theme options textarea
- Correctly Using checked function of WordPress
- Need help removing […] after excerpt
- Initial offset of number of posts in home page on the posts page
- display specific widget to a page
- Dynamically display font icons in widget
- Is it possible to isolate and use WordPress functions outside of wordpress
- WordPress 6.0 class-wp-widget.php fatal errors in PHP 8.1.6
- Time Delay a URL Redirect for Specific Page
- Cascading dropdown select search based on Parent Page & Child Page
- WordPress cascading dropdown selection search based on Parent Page & Child Page
- How do you create a custom category widget that you can style?
- Search bar for wp menu
- Executing php on button press
- I can’t go to the page archive-{post_type}.php
- Loading Widgets Via Child Theme
- Inserting a class on before_widget if checkbox is checked
- WP Website is shown in HTML
- Use Search Term in html link and redirect
- Mysterious letters appearing at the top of a few pages
- If user has clicked link add class and store using PHP/WordPress
- dashboard widget form not submit mails
- How to Protect a private folder inside uploads folder, if User is not Logged In?
- How to center all text body in single.php at once?
- sessionStorage saves input value in browser but it is not loaded in the form field
- Collapsible menu on post sidebar only expands and does not collapse
- How to make a “page-option” in WordPress
- Changable favicon
- How can I get my pagination loop to display the correct number of total pages?
- missing admin bar and widget in a template
- AMP version of e-commerce without plugin
- Use PHP to inject HTML into before page renders?
- How to make a parent page for author.php?
- user update profile for custom code
- My own theme’s custom widget areas are not working
- Vertical Menu for one page only
- Bootstrap Carousel Indicators Won’t Cycle On Custom WordPress Theme
- Multisite – Display different header content based on which site is accessed
- Show post/page into div using function
- wordpress, Category ID
- html to posts, jpg to featured image, zip file contains jpg and html
- How do you change the tag font size in the repeater-template.php [closed]
- PHP tag in post content makes wordpress go crazy
- How to only fetch certain Tag ID’s
- Where to find the html for WordPress site? [closed]
- widget: input the px value from user and use it as inline style in widget function
- RegExp to EXCLUDE strip HTML (FOR SOMME) comments
- Pagination for div’s
- wp nav menu without label
- Pass the updated value of aid from form using ajax
- WordPress – registering sidebar and adding a button directly after .textwidget
- How Can I Center the Logo in the Navigation Menu? [closed]
- Arrange Category post manually when displayed
- How to change links in the 3 main categories, on widget category, to a javascript function call
- WP Debug enabled Undefined index error in a widget
- HTML in PHP problem [closed]
- How to customize posts in WordPress by using HTML and CSS?
- Add multiple HTML attributes to an Elementor button
- Saving meta box data from selected option’s value in database is not working
- How to edit a widget code?
- Word press – JSPDF – Sending PDF as attachment from wp_mail – Special characters