Tagged: LayerSlider
-
AuthorPosts
-
May 30, 2013 at 8:25 am #23960
Hello,
I’ve an error when inserting php function for layerslider in my php theme files : “Fatal error: Call to undefined function layerslider() in …”
I inserted it like <?php layerslider(1, ‘homepage’); ?>, the good way I think.
Thanks for helping me.
May 30, 2013 at 10:29 am #121784Nobody use php function for displaying slider in homepage ?
May 30, 2013 at 11:29 am #121785I’ve found the BUG !
Happened when :
– creating a new page ; no content inside
– set this page as “A static page” in the Front page displays in “Settings > Reading”
Because there has never been a slider shortcode inside the page content, “ShortcodeHelper::$tree” is empty and not an array. So the function “post_has_layerslider” return always “false”.
How do I solve this temporarily ?
I inserted a layer shortcode inside page, I updated, and I deleted it just after. It seems that Avia keep in memory “av_layerslider” also when there is no more slider in page content.
May 30, 2013 at 2:28 pm #121786If you want to use php to call the slideshow (which imo doesn’t make much sense) you can try the do_shortcode function:
echo do_shortcode('[av_layerslider id="3"]');
Instead of 3 insert the id of your LayerSlider.
May 30, 2013 at 2:41 pm #121787Why it doesn’t make sense ?
You have created php function to display the slider in php files, so I use it !
PHP function “layerslider(xxx)” does the same as “do_shortcode(…)”, I want to use the best way to display my slider on homepage.
How do you manage this with the slider in demo ?
May 30, 2013 at 3:39 pm #121788We just use the advanced layout builder on the demo website. You can use the code from here: https://gist.github.com/InoPlugs/5d0d1477a0252aca1081 to reproduce the front page layout – just insert it into the “standard editor” and save the page. Then switch to the “advanced editor” to edit the elements.
June 1, 2013 at 5:15 pm #121789No I don’t want to use this method, I want to use the method you’ve planned for theme’s php files (I’m a developper so inserting a lot of shortcodes inside editor is not the best way for me)
June 1, 2013 at 8:25 pm #121790Hi JudeAAZ,
I have no idea where you got the idea that the theme somehow wants you to write php to make layouts. The theme demo uses only the tools within the wordpress admin area.
There is no custom php for any slideshow on the demo. It is entirely created using the Advanced Layout Editor.
Regards,
Devin
June 3, 2013 at 5:46 am #121791This is in your docs :
Calling the slider from your theme files
Because a slider can be an integral part of your site, you may want to place it into your theme files. There is a PHP function with filtering options which you can call for example from the header.php file of your theme and it inserts your slider into your home page or certail other pages depending on your filtering settings. Here is the function definition:
layerslider ( mixed $sliderID [, string $pages] )
...I prefer this way of doing than inserting shortcodes in editor. If you provide this function, I expect it to work !
June 3, 2013 at 7:57 am #121792We modified the layerslider shortcode and the default function layerslider() will not work. Also the docs are not written by us but they just come with LayerSlider plugin which is bundled with our theme and they do not reflect all supported features. As you pointed out above the
echo do_shortcode('[av_layerslider id="3"]');
does the same as layerslider(xxx) and it works out of the box. Please use this function. It’s actually even more efficient than the layerslider() function because you skip some “safety checks” (like if the shortcode syntax is valid, etc.).
June 3, 2013 at 8:26 am #121793Thanks for this explanation
-
AuthorPosts
- The topic ‘Layerslider in php file’ is closed to new replies.