• Resolved erwin

    (@oldtown11)


    Hi, Can I do a random number generator inside the HTML in progress bar?
    the goal is to make my progress bar generate a random number once a day and display them in the text and also the bar, also about the bar color could change by the percentage.
    If yes, would you give me some tips about how to use the logic inside the html?
    because I’m not really expert in a text coding.
    it would be very nice if you guys can help me.
    I also ask about this issue in here https://stackoverflow.com/questions/73046460/random-number-on-wordpress
    thank you for helping.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Chris Reynolds

    (@jazzs3quence)

    Hi! What you’re looking for isn’t supported by the plugin and would need some custom PHP or JavaScript to make it work. It’s totally possible to do what you want but not within the confines of the plugin, nor is it a feature that would naturally exist alongside the current featureset of the plugin.

    Additionally, HTML is static, so there’s no way to make HTML generate something dynamic like a random number, you would need something that can write and interpret logic and generate output based on that logic (e.g. PHP or JS).

    Thread Starter erwin

    (@oldtown11)

    Hello, thanks for the answer
    So do you mean that I still possible to do that, but I need to make a custom PHP or JS inside the progress bar plugin?
    or the progress bar plugin doesn’t support it at all and I need to looked for other one?
    thank you

    Plugin Author Chris Reynolds

    (@jazzs3quence)

    The Progress Bar plugin doesn’t support it at all. That’s not to say that you or someone else couldn’t take it and modify it to do the things that you want, but that’s outside the scope of what the plugin is able to do by itself.

    Thread Starter erwin

    (@oldtown11)

    So you recommend me to build a design by myself outside from the progress bar plugin sir?

    Plugin Author Chris Reynolds

    (@jazzs3quence)

    I am saying that what you are asking is not part of the Progress Bar plugin, nor is it within the scope of what the Progress Bar plugin should do. The plugin was built to solve a very simple, small task and should not be overburdened with a lot of extra features that stray from the original intent of simply displaying a styled and animated bar.

    If you want to inject a random number into the bar, you would first need to decide how you wanted to approach the problem, i.e. whether you wanted to write PHP code or write JavaScript code — as pure HTML does not support the creation of random numbers — and examine the plugin’s source code to get an understanding of how you could integrate the number into the progress bar. For example, does the random number change the length of the progress? If the number is truly random, is there a ceiling to the random number and should the bar reflect progress towards that ceiling? How are you going to ensure that the random number is randomized only once per day and not on every page load? Etc.

    Once you have an understanding of how the bar works, and what language you want to write it in, you could then take the code of the plugin — either by downloading it from www.ads-software.com here or by forking it on GitHub — and modifying the source code to accomplish your task.

    The beauty of open source software is that anyone can take a piece of software and modify it however they want. My recommendation would be to:

    1) outline all of the aspects of what you want the bar to do and write them out,
    2) decide on a language you want to use (the task you are asking about could work in either PHP or JavaScript),
    3) take the source code of the Progress Bar plugin and examine it so you understand how it works, and
    4) write the code!

    Even if you did not personally feel competent in accomplishing 2-4, the exercise of writing out your requirements in the first task would be beneficial if you decided to pay a developer to write the plugin for you. But the problem you want to solve is not difficult, and I’m fairly confident that with some research into writing JavaScript or PHP (or both) and possibly some WordPress internals, that you would be able to come up with a working solution.

    Thread Starter erwin

    (@oldtown11)

    Thank you sir
    I totally understand now
    It’s very beautiful plugin, thank you

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Random Number Daily Generate’ is closed to new replies.