Skip Navigation

[Resolved] how to generate incremental value in view

This support ticket is created 6 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 18 replies, has 2 voices.

Last updated by Beda 6 years, 4 months ago.

Assisted by: Beda.

Author
Posts
#952850

may be beda is not not having skills like other support people to help

#952851

hopeless

#952853

Here is an example of the JS called in the onclick attribute:
hidden link
Everything in myFunction(), if added in a JS code, will not accept any ShortCodes.

Now, if you would do as in the example linked (or do already) include the JS in the script tags, then it theoretically works with ShortCodes, but that is more by accident than intended.

However, you could:

<p id="demo" onclick="myFunction()">Click me.</p>

<script>
function myFunction() {
    document.getElementById("demo").innerHTML = "[shortcode]";
}
</script>

That, expands the ShortCode.

But using it in a JS function as argument like this:

myFunction(this, '[shortcode]')

That fails.
That is however, not related to the issue that it still would not "increment", given there is just one post if a loop doesn't loop over more items.

Remember that adding ShortCodes to Javascript in general is not something that WordPress "wants" you to do.
It generally is very restricted on ShortCodes and with Toolset you can do a but more, but not use ShortCodes in JS.
Here some info from WP as well:
https://make.wordpress.org/core/2015/07/23/changes-to-the-shortcode-api/

#952854

You would not even mind to read my reply.

I consider this issue closed.