2

I need make this work in an elementor text area.

I have multiple products pages and I want a counter for each one

An example of the facebook comment counter is this

(<span class="fb-comments-count" data-href="https://example.com/products/product1"></span>)

For a page with 2 comments the code do this: "Comments (2)"

Inside each page I have a facebook comment box and using shortcodes I can make it easily use the current url page.

But in the comment counter box I cant use shortcodes(just WYSIWYG), so I have to manually add the URL of the current page.

So what I want is automaticaly generate the current url inside of the comment counter code.

  • Something like this? jsfiddle.net/y67x3921 – Rick Sibley Apr 11 at 14:35
  • 1
    Using JavaScript you can build out the span element. Currently it does it when the page loads. Since there isn't much of an explanation I'm not sure what else you are looking for. If you can describe what you need more it might be easier to get help. what is https://example.com/products/product001 is this the page of the website or another location? Every time you move to a new page is that what you want the data-href to say? Or does only a section of the URL have to change? – Rick Sibley Apr 12 at 13:40
  • 1
    Thanks Rick, I've updated the post – Trooller Apr 12 at 14:35
  • 1
    Doesn't seem like I have enough knowledge on the development tools you are using. I left an upvote in hopes it pushes your question higher up for someone with the knowledge to answer. Best of luck. – Rick Sibley Apr 12 at 14:42
  • 1
    Thanks for the nice education Rick. I don't know how but it worked, haha. But something is causing a bug in the page when I upload it. I'm trying to find it – Trooller Apr 12 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.