Tagged: custom posts, init, LayerSlider
-
AuthorPosts
-
May 11, 2023 at 8:01 am #1407083
I have a custom post type called “locations”.
I am using a WordPress template called single-locations.php in a child theme for these individual custom posts.
There are thousands of posts in this custom post type, and none of the content on these posts have the [LayerSlider] shortcode in them and I am using the single-locations.php file to modify the post content to add it based on some simple conditions.
So far I can generate the the correct layerslider shortcode text and insert it into the custom post’s content, but the shortcode is printed out and not parsed.I have determined that it has to do with the LayerSlider not being initialized when it scans the custom post’s content, before I am able to modify the content at the time single-location.php is loaded in the processing tree.
Is there a way to trigger the loading/initialization of the LayerSlider parsing so that it can handle the [layerslider id=”##”] tag at the time I modify it and output the contents to the browser?May 11, 2023 at 8:07 am #1407084I have referred to a variation of this patch to get the layerslider parsed and display in my content, but every time that I install a new version of the theme, this patch will get overwritten.
It would be nice to be able to have a solution that works in my child theme.May 13, 2023 at 10:05 pm #1407307Hi,
Thanks for your question but this patch is already in the current enfold\config-layerslider\config.php on line 743
If you mean that you have customized the patch to work for your situation then you can try adding the modified ‘config-layerslider’ directory to your child theme, but I don’t think this will work because the parent theme functions.php calls the ‘config-layerslider/config.php’ directly on line 106.Best regards,
MikeMay 25, 2023 at 11:39 pm #1408593Yes I do mean that I have modified the patch even further beyond what is currently now available as the patch in question.
I don’t like the way that enfold chooses whether or not the layer slider is available in the logic, and furthermore I don’t like how we can’t change that with a child theme.It would be pertinent to be able to make this modification at the child theme level.
May 26, 2023 at 11:37 am #1408662Hi,
I’m not sure so I have asked the rest of the team for advice, thank you for your patience.Best regards,
MikeMay 26, 2023 at 12:37 pm #1408668Hi,
The Dev Team replied to try adding a copy of our file (\config-layerslider\config.php) in child theme and remove these lines from the bottom:function Avia_Config_LayerSlider( $class_name = '' ) { return Avia_Config_LayerSlider::instance( $class_name ); } /** * Initialise class and hooks */ Avia_Config_LayerSlider();
Make the modifications you want to make in the child theme file, at end of functions.php of child theme include this file.
When the original file is loaded by the theme functions.php it recongnizes that the class already exists and only executes the lines at the bottom,Best regards,
MikeJune 23, 2023 at 10:51 pm #1411520I was able to make these changes and it works as expected!
Thank you!June 24, 2023 at 12:06 pm #1411543 -
AuthorPosts
- You must be logged in to reply to this topic.