Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1107943

    As of LayerSlider documentation, that you can find here,
    it should be possible to hook to some actions to add custom html. In particular layerslider_before_slider_content and layerslider_after_slider_content, but it’s not working.

    Echoing my custom div using the action layerslider_after_slider_content the div appears before the slider and not after.
    So I checked in your file enfold/config-layerslider/LayerSlider/includes/slider_markup_html.php and I discovered that the whole slider output is put into an array varaible ($lsMarkup) and it’s printed later, in another file. That’s why it goes before the actual slider.

    So, to make it work, instead of echoing my div in my function, I appended it to the array varialble, that obviously it’s not available in my function, meaning that I had to edit your file and add global $lsMarkup; around the top of slider_markup_html.php file.

    Now it’s working fine, but do you think it’s useful to fix this thing in my way to allow those actions to work properly?

    Thanks

    Andrea

    #1108449

    Hey f.giorgini,
    Sorry for the late reply, glad to hear you were able to create a solution, but can you link to a copy of your layerslider_after_slider_content function so we can try to recreate the issue?

    Best regards,
    Mike

    #1108853

    Hi Mike and thanks for your reply.
    You can actually try it by printing whatever comes in your mind and then check via Chrome Dev Tools, where the new div was inserted.
    This is an example:

    add_action( 'layerslider_after_slider_content', 'add_div_after_slider' );
    function add_div_after_slider() {
    	echo '<div id="my-new-div">Blah blah</div>';
    }

    You will see that it’s added before and not after the slider code, for the reason I explained in my previous post.

    #1109702

    Hi,
    Sorry for the late reply, and thanks for the example code. I was able to reproduce so I wrote a report for the dev team to review your solution.
    Thanks for sharing.
    I will post here as I learn more.

    Best regards,
    Mike

    #1109853

    Hi!

    The file enfold\config-layerslider\LayerSlider\includes\slider_markup_html.php containing this hook is part of layerslider plugin – there is not much we can do.

    I will ask if we can forward this to layerslider devs. Maybe you can also try to place a report about that there?

    Best regards,
    Günter

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.