You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A while ago, in WordPress 6.2, the ability to include shortcode in template parts was removed.
The call to do_shortcodes() was no longer being invoked on template parts.
This caused a bit of a kerfuffle.
But it wasn't a problem for my FSE themes since I was overriding template part processing.
The problem's now been resolved but caused me a bit of a headache as I tried to remember what to do...
I got nowhere for quite a while yesterday evening until I realised that I hadn't enabled my oik shortcodes.
The fix was to add some logic in functions.php.
/**
* Enables oik based shortcodes.
*/
function oobit_init() {
if (function_exists('bw_add_shortcode')) {
do_action("oik_add_shortcodes");
}
}
add_action( 'init', 'oobit_init', 20 );
During init processing we check if the function bw_add_shortcode is present. If it is then oik has been loaded so we should be able to run the oik_add_shortcodes action to cause oik and other plugins to lazy load shortcodes.
I'll need to use several oik based shortcodes which haven't yet been replaced by blocks ( e.g. [bw_blogs] ) and therefore probably need to include these in template parts rather than directly into templates.
Note: Rather than having every theme that's dependent upon oik to implement this it would be better if
either oik could detect the need to invoke the action.
or all the shortcodes are implemented as blocks.
The text was updated successfully, but these errors were encountered:
Rather than having every theme that's dependent upon oik to implement this it would be better if
either oik could detect the need to invoke the action.
I've prototyped a solution that oik can use to improve support for block themes.
Note that this improvement to oik may not totally negate the need for functions.php.
It may still be necessary to implement some or all of the following
custom block styles
filter functions to adjust rendered block output - eg render_block_core/shortcode
block override logic
For information about using filter functions to enable shortcodes to be used in the query block see bobbingwide/fizzie#28 (comment)
It may also be possible to implement the relevant code in a plugin. See the bigram plugin for several block rendering overrides including the classic block (filter name render_block_).
A while ago, in WordPress 6.2, the ability to include shortcode in template parts was removed.
The call to do_shortcodes() was no longer being invoked on template parts.
This caused a bit of a kerfuffle.
But it wasn't a problem for my FSE themes since I was overriding template part processing.
The problem's now been resolved but caused me a bit of a headache as I tried to remember what to do...
I got nowhere for quite a while yesterday evening until I realised that I hadn't enabled my oik shortcodes.
The fix was to add some logic in
functions.php
.During init processing we check if the function bw_add_shortcode is present. If it is then oik has been loaded so we should be able to run the
oik_add_shortcodes
action to cause oik and other plugins to lazy load shortcodes.I'll need to use several oik based shortcodes which haven't yet been replaced by blocks ( e.g. [bw_blogs] ) and therefore probably need to include these in template parts rather than directly into templates.
Note: Rather than having every theme that's dependent upon oik to implement this it would be better if
The text was updated successfully, but these errors were encountered: