• Hi, great little plugin, my friend who’s website I maintain for him (non paid) wants to use the progress bar, but wants a simple tweak.
    Basically he would like to instead of every time he updates his page, a way of adding say 5 default text strings, different text based upon the progress percentage reducing the chance of mistakes and typo’s.
    He has a few ideas and would make a donation if you could provide any changes for a small fee.
    I guess also ideally he would like the text to appear just above the bar centrally and is other idea was to have like a graticule along the edge such that he put the text string’s in ranges ie.
    5-20% ‘slim chance’
    20-30% ‘nibbling’
    30-40 ‘good pickings’
    40-60 ‘etc’
    60-90 ‘etc’
    Any how please advise, many thanks in advance
    regards
    Mark

    http://wordpress.org/plugins/progress-bar/

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

    (@jazzs3quence)

    Sure it’s possible, but you’d need to go into the code and fork the plugin to add the parameters to output the desired strings based on the percentage. Alternately, he could just use the text="your text here" parameter, but that wouldn’t be automated. The only way to automate it would be to code it. And the only way to code it would be to hack the plugin.

    If that’s the direction you did want to go, I could add a filter hook so you could at least use that instead of hacking the plugin and ruling out the chance that you’d ever be able to update the plugin.

    Thread Starter lizmarc

    (@lizmarc)

    Hi Chris, many thanks for the reply, it sounds like a good idea for you to be able to create this ‘filter hook’ not sure how your implementation would work? I could spend considerable time trying hack your code 🙂 and it would probably not work again…
    I was thinking in simple terms maybe in the function var entries;
    you would go something like text= “string 1, string 2, …4 or 5” and your code may do some magic breaking the string parts into an array. Then doing the logic ‘IF then else ‘against the percentage value < n to to put the appropriate string into the bar?
    However
    I did wonder if it was possible to do this on the page with another plugin or method of stipulating the var values but my recent readings on what can actually done a wordpress page without using custom templates and such like, noting I have created the whole site using the suffusion theme a couple of years ago.
    I have looked at plugins like php exec/ snippet – such that it could pre manipulate the logic and pass the parameters but being a complete novice with no experience in CSS / java / php programming with wordpress, It may be totally the wrong direction etc.
    So please advise me what your ‘hook’ method would be and what ‘costs’ may be involved. Many thanks kind regards Mark

    Plugin Author Chris Reynolds

    (@jazzs3quence)

    What I’m thinking is the filter would alter the output that displays in the progress bar. So that content would be passed in a variable and then you could write your own filter to modify that content. So, in your case, you’d have just a numeric string that you’d then manipulate in your filter and the plugin would apply that filter to the output so it displays the way you want and overrides the default behavior. Does that make sense?

    All the magic (breaking the string into parts, etc) would be done in the filter. Otherwise, it would be impossible to anticipate the various ways people could want to implement custom messages.

    Take a look at http://codex.wordpress.org/Plugin_API/Hooks for mor information about hooks and filters.

    Thread Starter lizmarc

    (@lizmarc)

    Hi Chris thanks again, for your quick reply, I have taken a quick look at the url you passed and I can sort of see / envision what you are saying…
    obviously being no programmer… My interpretation of what you have said is that you can slightly modify your plugin with an option that if selected can allow a different set of parameters to be input.
    I still feel lost however on to how I would write my ‘filter’ and pass the parameer… other than what I said previously 🙂
    thank you Mark

    Plugin Author Chris Reynolds

    (@jazzs3quence)

    What you are looking for is a very specific use case that wouldn’t be applicable for other users and, as I’ve said before, would probably need to be custom developed. I can make it as easy as possible for a developer to add the functionality you are looking for to the plugin without having to actually hack the plugin itself, but it’s still going to require some php programming to make it do what you want it to do. If you are looking for a developer to build this functionality for you, you can contact me, find a developer on the CodePoet directory or post your project on the jobs.wordpress.net board.

    Otherwise, if you are looking to do it yourself, there are lots of books & tutorials on how to write a plugin to help you get started. Since you initially said that this was an unpaid gig for a friend, though, I’d respectfully inform him that you’re highly underpaid for this job and request a raise. 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘display different text string regarding percentage’ is closed to new replies.