wp enqueue script – How to get enqueued files included directly in the result of get_template_part
Question
I am caching a footer – I call get_template_part
and cache the contents.
But the footer has a script file enqueued in functions.php.
That script does not get included in the cached content.
Here is the caching:
ob_start();
get_template_part(
$templatePathSlug,
null,
$variablesArray
);
$cacheData = ob_get_clean();
The $cacheData
does not have the enqueued stuff, since I guess that is added later when the page loads(?)
Can I get it to include the enqueued files directly when calling get_template_part ?
Or is there some other way?
0
2 months
2023-04-01T12:05:07-05:00
2023-04-01T12:05:07-05:00 0 Answers
0 views
0
Leave an answer