Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #695391

    Hello guys
    I have a problem with using a shortcode in the LayerSlider. I have read a lot about other topics regarding this issue but not sure if it is just not possible. I have created a custom shortcode in my child theme functions.php file like this:

    function ticketcounter() {
    $product_id = 23947;
    $product = wc_get_product($product_id);
    $productcount = $product->get_stock_quantity();
    return $productcount;
    }
    add_shortcode(‘myticketcounter’, ‘ticketcounter’);

    It displays fine on a page and shows the actual stock quantity. But when i use it on the LayerSlider it shows the stock quantity at the moment i save the slider but it does not update the stock quantity after this point.

    Any ideas?

    Kind regards,
    Michael Storm

    • This topic was modified 7 years, 6 months ago by mstorm85.
    #696350

    Anyone?

    #697344

    Hi,

    can you provide us screenshots to make it clear to us about which elements you’re talking exactly? I can’t find any stock quantity on the link you’ve provided.

    However, I think this would be out of our support scope and a job for a freelance developer.

    Best regards,
    Andy

    #697355

    Hello Andy

    I work professionally with webdesign so you could call me a freelancer – i have bought several licens to Enfold. I had to remove the layerslider duo to a deadline so you wont find the layerslider on the link i provided anymore.

    I can not activated now as my deadline is tomorrow and i have to finish up the website. But the problem still exist.

    A custom shortcode function only provides an output on save. It does not update on every page load. In an other post I saw someone write that it obviously does not run the shortcode function but not why.

    I can not provide a link at this moment but if you find a solution to this “issue” it would be great for future projects. Is i wrote it works perfectly on regular pages so the shortcode worked fine. Just not in the layerslider.

    Kind regards,
    Michael

    #697724

    Hi,

    we need a link showing the elements and the issue you’re talking about, to be able to inspect everything. Let me know when you can provide us a test link.

    Best regards,
    Andy

    #697728

    Hey Andy

    I understand. Just close the topic. I can not provide a link on this project anymore duo to the deadline i had. I dropped the LayerSlider and just added a color section instead.

    Kind regards,
    Michael

    #697748

    Hi,

    alright! Let us know in a new ticket if you have some more questions related to the theme. We are happy to assist you.

    Best regards,
    Andy

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Custom shortcode in layerslider’ is closed to new replies.