Resolved – I’ll use a repeater field with dynamic data and won’t need to edit the HTML template.
Actually, not resolved. Is there a way of doing this – could a custom template be enabled in another location for Oxygen Builder users?
Hello @pixelshrink,
I apologize for not replying sooner.
Please try the scripts below ( add them to the functions.php file of the theme ).
The script will look for your custom templates in the custom folder wp-content/uploads/gmw-templates
You can change the folder destination by changing it in both scripts.
function gmw_custom_modify_get_template( $custom_path_uri ) {
$custom_folder = 'wp-content/uploads/gmw-templates';
$custom_path_uri = array(
'path' => ABSPATH . $custom_folder,
'uri' => get_site_url( '', $custom_folder ),
);
return $custom_path_uri;
}
add_filter( 'gmw_get_template_path_uri', 'gmw_custom_modify_get_template', 50 );
function gmw_cusotm_template_files_folder( $url ) {
// enter the custom location for the template files.
$custom_folder = 'wp-content/uploads/gmw-templates/';
return ABSPATH . $custom_folder;
}
add_filter( 'gmw_get_templates_path', 'gmw_cusotm_template_files_folder', 50 );
I hope this helps.
Let me know if you have any questions.
Thanks very much for that, just had chance to look at it.
With the Posts locator, I can’t see the custom template in the templates list in the settings. The paths to the custom templates are:-
/wp-content/uploads/gmw-templates/posts-locator/search-forms/…
and
/wp-content/uploads/gmw-templates/posts-locator/search-results/…
I’ve tried naming the custom template folder the same as the original it was copied from, or something new, but neither seems to work.
Do you have any ideas on why it’s not working please? Oxygen disables the theme so there’s no functions.php to add it to, so instead I’ve added it to a https://dplugins.com/products/scripts-organizer/ script where all the other scripts are working, which is a standard way to add php to Oxygen Builder sites.
-
This reply was modified 4 years, 11 months ago by
pixelshrink.
Hello @pixelshrink,
I am not sure why it isn’t working for you.
I don’t have the Scripts organizer plugin to test the script with, but I did test it with the “Code Snippets”, which is a similar plugin, and it is working.
Are you able to provide me with a screenshot of the scripts added to the Script organizer plugin on your site?
Thanks Eyal, sure, here’s the link. The rest of the scripts in the same file work as they should.
https://drive.google.com/file/d/1gmgbAJCtNYyHyjUjVGEIUU2PsW2-niNo/view?usp=sharing
-
This reply was modified 4 years, 11 months ago by
pixelshrink.