gmazzap / atp Goto Github PK
View Code? Open in Web Editor NEWajax_template_part() for WordPress
License: MIT License
ajax_template_part() for WordPress
License: MIT License
I stumbled on your ATP plugin yesterday evening and gave it a try. Whenever I tried to render any form of post content (namely excerpt and, well, post content), it came back blank. The reason for that is that get_the_content()
needs global $pages
, which is set by setup_postdata()
. ATP does handle that, of course, I found it here:
https://github.com/Giuseppe-Mazzapica/ATP/blob/ebb4808429da97028aa24db93597ec7d4dfb7d9f/src/Loader.php#L106-L107
But in my case, it never actually goes into that if clause. Does that ring a bell for you? Right now, I have to setup_postdata()
myself right in the template part to make it work
Hi Giuseppe,
Again, thanks so much for making this. It's really, really excellent.
As the title says, I was wondering if I'm able to invalidate the cache manually when a certain thing happens. i.e. Ii'd love to be able to invalidate the cache during a manual AJAX call so that on next page reload, the template part that is affected loads from fresh, rather than the cache.
Any thoughts, here?
Could there be some filter introduced to disable plugins on AJAX requests?
This article explains what I mean:
https://deliciousbrains.com/excluding-wordpress-plugins-loading-specific-ajax-requests/
Hi,
when a user is not logged in I get the following error message and the templates are not being loaded:
PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ' GM\ATP\ajax_callback' not found or invalid function name in /.../wp-includes/class-wp-hook.php on line 298
Any idea why this might be happening and what a possible solution would look like?
Hi Giuseppe,
Firstly, thanks so much for this, it is awesome.
I've come across a slight issue with regards to loading template files that are in sub directories. get_template_part() allows you to pass a path as the first argument. i.e.
get_template_part( 'templates/tha_entry_top/entry', 'test' );
would load a file called entry-test.php
in my theme's templates/tha_entry_top/ directory.
However, it appears that THA strips the forward slashes. I tried both
ajax_template_part( 'templates/tha_entry_top/entry', 'test' );
and
ajax_template_part( 'templates\/tha_entry_top\/entry', 'test' );
to see if I could manually unescape them, but both produced the following POST request form data;
action:ajaxtemplatepart
files_data[ajaxtemplate-templatestha_entry_topentry-test-1][]:templatestha_entry_topentry
files_data[ajaxtemplate-templatestha_entry_topentry-test-1][]:test
posts_data[ajaxtemplate-templatestha_entry_topentry-test-1]:1
Which, naturally, leads to the template not loading.
I'm a bit of a sucker for having a clean theme root directory, so I'd absolutely love ATP to allow templates to be loaded from sub directories. Again, thanks so much for writing this. It. Is. Awesome.
Hi
Thank for this plugin but I have got this error while activating
The plugin generated 2139 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.
Any idea?
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.