svandragt / htmxpress Goto Github PK
View Code? Open in Web Editor NEWWIP plugin to power WordPress with HTMX
WIP plugin to power WordPress with HTMX
Could be a theme issue (2023). it generalyl shows too much layout in the results, let's clean up the demo.
I was having trouble with hx-post
to /htmx/demo/partial-ascii
and it turns out that the nonce in $_SERVER
is actually called HTTP_X_WP_NONCE
and not X_WP_NONCE
.
After fixing it locally, I was getting the right response instead of getting the security nope
. (uncommented for debugging)
I am uncertain if this is an issue with my (very vanilla) setup or a bug.
Also, very cool idea to integrate htmx with WordPress. This feels like it could be very productive!
https://django-htmx.readthedocs.io/en/latest/index.html
spike for new features
Thought to try this out on a minimal client WP ajax-widget project and partially out of personal interest in django+htmx development. I didn't get it to run after half a day trying to run the demo however.
I set up the suggested wp-env development environment on Debian stable (NodeJS v18.13.0, Docker version 24.0.2 rootless). wp-env start
gets the stock WP installation up and running with htmxpress-plugin activated ok and not producing errors. Htmx javascript file loads globally on site (from unpkg.com).
When accessing demo urls I only get the classic Apache "Not Found" 404 page, access log:
"GET /htmxpress HTTP/1.1" 404 489 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0"
"GET /htmx/ascii HTTP/1.1" 404 490 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0"
"GET /html/partial-ascii HTTP/1.1" 404 490 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0"
"GET /htmx/demo HTTP/1.1" 404 490 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0"
Same results on Mac M1, Docker Desktop 4.19.0.
"GET /htmx/demo HTTP/1.1" 404 490 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/114.0"
Another trial with Linux laptop and using VVV vagrant box which is personally more familiar tool. Installing htmxpress plugin as zip on the default "wordpress-one" site. Htmx script loads ok here as well. Accessing https://one.wordpress.test/htmx redirects to same url with ending slash and just shows the stock WP home page.
Access log:
192.168.56.1 - - [01/Jul/2023:14:21:26 +0000] "GET /htmx HTTP/1.1" 301 5 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0"
192.168.56.1 - - [01/Jul/2023:14:21:26 +0000] "GET /htmx/ HTTP/1.1" 200 13372 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0"
192.168.56.1 - - [01/Jul/2023:14:33:58 +0000] "GET /htmx/ascii HTTP/1.1" 301 5 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0"
192.168.56.1 - - [01/Jul/2023:14:33:59 +0000] "GET /htmx/ascii/ HTTP/1.1" 200 13372 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0"
192.168.56.1 - - [01/Jul/2023:14:38:24 +0000] "GET /htmx/partial-ascii HTTP/1.1" 301 5 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0"
192.168.56.1 - - [01/Jul/2023:14:38:25 +0000] "GET /htmx/partial-ascii/ HTTP/1.1" 200 13372 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0"
192.168.56.1 - - [01/Jul/2023:14:38:50 +0000] "GET /htmx/demo HTTP/1.1" 301 5 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0"
192.168.56.1 - - [01/Jul/2023:14:38:51 +0000] "GET /htmx/demo/ HTTP/1.1" 200 13372 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0"
Spent bit of time reading WP Rewrite Endpoints API docs and related code but didn't get any further yet...
When completed, it's possible to install htmxpress for composer.json WordPress projects, as follows:
composer config repositories.htmxpress vcs [email protected]:svandragt/htmxpress.git
composer require svandragt/htmxpress:dev-main --no-update
composer update svandragt/htmxpress --prefer-source
Deprecated: File Theme without header.php is deprecated since version 3.0.0 with no alternative available. Please include a header.php template in your theme.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.