Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • #842823

    Dear Support,
    I want to have a layer slider visible on my every blog post. I added the following to the ‘single.php’

    echo do_shortcode('[layerslider id="9"]');

    but instead of seeing the slider I can see the text

    [layerslider id=”9″]

    I also tried with

    <?php layerslider(9); ?>

    but this time I have received

    Fatal error: Call to undefined function layerslider()

    Currently I am using

    WP: 4.8.1
    Theme: Enfold
    Version: 4.1
    Installed: enfold
    AviaFramework Version: 4.6
    AviaBuilder Version: 0.9.5

    Can you help me please?

    Thank you for your time!

    Best regards,
    MD

    • This topic was modified 7 years, 3 months ago by midudek1.
    #843161
    This reply has been marked as private.
    #844270

    Hi,

    Thank you for using Enfold.

    I’m sorry but you can’t use the layer slider as a shortcode because the scripts are not going to load properly. There’s a workaround but we don’t recommend it.

    // https://kriesi.at/support/topic/adding-avia-elements-to-woocommerce-archive-product-php/#post-710560

    Best regards,
    Ismael

    #844552

    Dear Ismael,
    Thank you for your help. Not only the shortcodes do not work but also the PHP script. At least the PHP should work …

    Why is that?

    I would like to have tags on my blog single post, thus I need to use single.php because tags do not work with Advanced Layout Editor … but now if I understand correctly the integration with Layer Slider does not work in single.php?

    So how I can achieve tags + layer slider in the single blog post?

    Thank you for your time.

    Best regards,
    MD

    #844682

    Hi,

    It is disabled by default. Did you try the suggestion above? You have to include the layer slider scripts manually if you want to add it directly in the templates.

    Best regards,
    Ismael

    #845030

    Dear Ismael,
    I did not try it, because you said that the workaround from the above is not recommended. So my question is … what is a recommended way? Shouldn’t that behavior (lack of “good ways” of adding layer slider to single blog post; PHP code not interpreted correctly etc.) considered as a bug?

    Best regards,
    MD

    P.S I will try the “bad way” on the dev machine.

    • This reply was modified 7 years, 2 months ago by midudek1.
    #845647

    Hi,

    Please edit the config-layerslider > config.php file, look for the following line of code and remove it.

    if(!is_admin() && !post_has_layerslider()) return;
    

    You’ll be able to use the shortcode after that.

    echo do_shortcode('[av_layerslider id="1"]');
    

    This is disabled by default because it creates a lot of errors in the page.

    Best regards,
    Ismael

    #846432

    Dear Ismael,
    Thank you for your help. I have a look at the topic you posted above. It was a bit unclear for me at the beginning but I believe I have found a “nicer” way to include the LayerSlider in every blog post.

    For people who are interested, here are the steps:
    1.) as I am using child theme … if you don’t, then you need to modify directly the Enfold files … just be aware that after update those modification WILL DISAPPEAR … that is why it is better to use child theme
    2.) copy “single.php” to your child directory … name of the file stays the same
    3.) copy “header.php” to your child directory and give it a name “header-single.php”
    4.) in you child directory create files “layerslider-header.html” and “layerslider-main.html”
    5.) edit “single.php” and look for “get_header();” and replace it with “get_header(‘single’);”
    6.) edit “header-single.php” and look for “wp_head();” and replace it with

    wp_head();
    include('layerslider-header.html');
    

    7.) edit again “single.php” and add the following

            <?php include('layerslider-main.html'); ?>
            <div id='after_layer_slider_1' class='main_color av_default_container_wrap container_wrap fullsize'>
    

    BEFORE

    <div class='container_wrap container_wrap_first main_color <?php avia_layout_class( 'main' ); ?>'>
    

    and REMEMBER to close the <div> at the end of a file. The end should look like this

                            </div><!--end container-->
                    </div><!-- close default .container_wrap element -->
            </div><!-- close 'after_layer_slider_1' -->
    <?php get_footer(); ?>
    

    8.) edit “layerslider-header.html” and put the following inside … just REMEMBER to change your domain name from “example.com” to the one you are using

    <link rel='stylesheet' id='layerslider-front-css'  href='http://example.com/wp-content/themes/enfold/config-layerslider/LayerSlider/static/public/front.css?ver=6.5.1' type='text/css' media='all' />
    <link rel='stylesheet' id='layerslider-css'  href='http://example.com/wp-content/themes/enfold/config-layerslider/LayerSlider/static/layerslider/css/layerslider.css?ver=6.5.1' type='text/css' media='all' />
    <script type='text/javascript' data-cfasync="false" src='http://example.com/wp-content/themes/enfold/config-layerslider/LayerSlider/static/layerslider/js/greensock.js?ver=1.19.0'></script>
    <script type='text/javascript' data-cfasync="false" src='http://example.com/wp-content/themes/enfold/config-layerslider/LayerSlider/static/layerslider/js/layerslider.kreaturamedia.jquery.js?ver=6.5.1'></script>
    <script type='text/javascript' data-cfasync="false" src='http://example.com/wp-content/themes/enfold/config-layerslider/LayerSlider/static/layerslider/js/layerslider.transitions.js?ver=6.5.1'></script>
    

    9.) now edit “layerslider-main.html” and put the following inside … just REMEMBER to change your domain name from “example.com” to the one you are using

    <div id='layer_slider_1' class='avia-layerslider main_color avia-shadow  avia-builder-el-1  el_after_av_textblock  el_before_av_textblock  slider-not-first container_wrap fullsize'    style='height: 157px;' >
    <script data-cfasync="false" type="text/javascript">var lsjQuery = jQuery;</script><script data-cfasync="false" type="text/javascript">
    lsjQuery(document).ready(function() {
    if(typeof lsjQuery.fn.layerSlider == "undefined") {
    if( window._layerSlider && window._layerSlider.showNotice) { 
    window._layerSlider.showNotice('layerslider_9','jquery');
    }
    } else {
    lsjQuery("#layerslider_9").layerSlider({sliderVersion: '6.5.1', type: 'fullwidth', skin: 'fullwidth', hoverPrevNext: false, navStartStop: false, navButtons: false, showCircleTimer: false, popupWidth: 640, popupHeight: 360, skinsPath: 'http://example.com/wp-content/themes/enfold/config-layerslider/LayerSlider/static/layerslider/skins/'});
    }
    });
    </script>
    <div id="layerslider_9" class="ls-wp-container fitvidsignore" style="width:1300px;height:156px;margin:0 auto;margin-bottom: 0px;">
    <div class="ls-slide" data-ls="bgcolor:#041c2c;kenburnsscale:1.2;"><img width="1158" height="795" src="http://example.com/wp-content/uploads/images/website/baner.electrical.circuit.png" class="ls-l" alt="" srcset="http://example.com/wp-content/uploads/images/website/baner.electrical.circuit.png 1158w, http://example.com/wp-content/uploads/images/website/baner.electrical.circuit-300x206.png 300w, http://example.com/wp-content/uploads/images/website/baner.electrical.circuit-768x527.png 768w, http://example.com/wp-content/uploads/images/website/baner.electrical.circuit-1030x707.png 1030w, http://example.com/wp-content/uploads/images/website/baner.electrical.circuit-705x484.png 705w, http://example.com/wp-content/uploads/images/website/baner.electrical.circuit-450x309.png 450w" sizes="(max-width: 1158px) 100vw, 1158px" style="top:18px;left:-463px;text-align:initial;font-weight:400;font-style:normal;text-decoration:none;wordwrap:false;opacity:1;mix-blend-mode:normal;" data-ls="fadein:false;clipin:0;transitionout:false;">
    </div></div></div>
    

    10.) this workaround works with WP 4.8.1, Enfold 4.1.2 and LayerSlider 6.5.1

    In simple words I have copy & pasted the generated LayerSlider code (on other page build with Advanced Layout Editor) and put it in the correct places in <header> and <body> of the single post template.

    Hope that descriptions will help some of you … Kriesi has quite a lot of room for improvements here …

    Best regards,
    MD

    • This reply was modified 7 years, 2 months ago by midudek1.
    #846437

    Dear Ismael,
    Don’t you think that the issue with the LayerSlider, lack of possibility of usage of LayerSldier short codes and PHP code should be considered as a bug?

    Best regards,
    MD

    #846759

    Hi,

    Don’t you think that the issue with the LayerSlider, lack of possibility of usage of LayerSldier short codes and PHP code should be considered as a bug?

    It’s not a bug, it’s intentional. Did you try our previous suggestion?

    // https://kriesi.at/support/topic/layerslider-on-every-blog-post/#post-845647

    It’s much easier but you have to modify one of the parent theme files.

    Best regards,
    Ismael

    #848781

    Dear Ismael,
    Thank you for your reply and help.

    I did not try the previous solution because you stated that “it creates
    a lot of errors in the page”. I do not want that.

    From the commercial product I expect much more and what I can see after
    buying Enfold is that for many things there are no real fixed but
    workarounds all the time. Some features work only is “specific” cases
    (1) for others you need to do nasty hacks (2), in some cases Enfold is
    breaking compatibility with important plugins (3) and now I have learned
    that some core functionalities ((4) — this topic) are disabled on
    purpose because the problem was not fixed … again only workaround is
    available … that is really disappointing.

    (1) https://kriesi.at/support/topic/image-with-hotspots-does-not-work-with-default-wordpress-editor/
    (2) https://kriesi.at/support/topic/layerslider-on-every-blog-post/
    (3) https://kriesi.at/support/topic/advance-layout-editor-is-breaking-syntax-highlight/
    (4) https://kriesi.at/support/topic/layerslider-on-every-blog-post/

    Eventually I managed to do what I wanted, you can close this topic.

    Thank you for your help and support … in all of my complains I really
    appreciate it and I think you react very fast.

    Best regards,
    MD

    #848943

    Hi,

    I did not try the previous solution because you stated that “it creates
    a lot of errors in the page”. I do not want that.

    That was for the previous modification where you have to include the script manually. We provided a new one where you can just edit one line of code to enable the default shortcode again.

    // https://kriesi.at/support/topic/layerslider-on-every-blog-post/#post-845647

    Anyway, I’m glad that you found a workaround you’re happy with. The term “workaround” is the same as fixing a plugin or enabling a certain feature of a plugin/theme which is quite normal if you’re familiar with web dev.

    Best regards,
    Ismael

    #851282

    Dear Ismael,
    In your comment #845647 you have written

    This is disabled by default because it creates a lot of errors in the page.

    which means it should NOT be used … and it was NOT about the manual scripts … or I am missing something.

    Best regards,
    MD

    • This reply was modified 7 years, 2 months ago by midudek1.
    #851414

    Hi,

    This is disabled by default because it creates a lot of errors in the page.

    It mostly creates layout and rendering errors such as the height and resize response but nothing critical.

    Best regards,
    Ismael

    #853530

    ;-)

    If it creates any errors it means it is wrong.

    MD

    #853731

    Hi,

    Alright. Please open a new thread if you need anything else.

    Best regards,
    Ismael

Viewing 16 posts - 1 through 16 (of 16 total)
  • The topic ‘LayerSlider on every blog post’ is closed to new replies.