WordPress.org

Forums

HMS Testimonials
[resolved] Help with javascript (7 posts)

  1. spirittlk
    Member
    Posted 1 year ago #

    Hi, I'm trying to convert this shortcode to js:
    [hms_testimonials_rotating template=“13" order="random" direction="ASC" char_limit="500" seconds="20" ]

    This is what I attempted - but I must be doing something wrong as I see nothing loaded:
    <script type=“text/javascript” src=“http://www.visionsofheaven.com/_aatest/wp-content/plugins/hms-testimonials/js.php?template=13&order=random&direction=ASC
    &char_limit=500&seconds=20”></script>

    This is the page and I'm attempting to load these in the grey box near bottom right.
    http://www.visionsofheaven.com/_aatest/biography/

    The shortcode works perfectly. Thanks!

    https://wordpress.org/plugins/hms-testimonials/

  2. Jeff K
    Member
    Plugin Author

    Posted 1 year ago #

    Hello.

    The output of the javascript on your page is

    <script type=“text/javascript” src=“http://www.visionsofheaven.com/_aatest/wp-content/plugins/hms-testimonials-rotator/js.php?template=13&order=random&direction=ASC
    &char_limit=500&seconds=20”></script>

    There are a few issues here. First, the quotes are not regular quotes. Secondly, you have the path to the plugin directory wrong.

    Try this instead

    <script type="text/javascript" src="http://www.visionsofheaven.com/_aatest/wp-content/plugins/hms-testimonials/js.php?template=13&order=random&direction=ASC&char_limit=500&seconds=20"></script>

    Make sure you have this feature enabled in the Advanced setting of the plugin.

    Out of curiosity, if this is a WordPress page why are you using the javascript implementation instead of the the shortcode?

    Jeff

  3. spirittlk
    Member
    Posted 1 year ago #

    Hi Jeff,

    Thank you for responding. I tried your suggestion - I copied the code you gave me exactly, but it still didn’t work - My theme just printed the code on the page (I use a theme that uses visual composer, so I am cutting and pasting into the "raw Js" option under VC).

    Next I tried this with regular quotes:
    <script type="text/javascript" src="http://www.visionsofheaven.com/_aatest/wp-content/plugins/hms-testimonials/js.php?template=13&order=random&direction=ASC&char_limit=500&seconds=20”></script>

    When I look at the source it appears to be understanding it as javascript - I can click on the link and it takes me to the js.php file, but it does not run it on the page. I DO have this feature enabled under the advanced settings on the wordpress site, and still no go.

    I don’t know if it is understanding the arguments for the quote rotator - order, direction, char_limit, etc?

    The reason I was attempting to us the javascript version is that it takes a long time to load all my testimonials when using the wordpress shortcode. I thought perhaps JS would load faster. I have over 220 testimonials.

    Any thoughts?
    Thank you,
    Ann

    ps - referring to this page, bottom right:
    http://www.visionsofheaven.com/_aatest/biography/

  4. Jeff K
    Member
    Plugin Author

    Posted 1 year ago #

    Hey Ann,

    2 things.

    First off, you stumbled across a bug from a few updates ago that broke the javascript. This isn't a thoroughly used feature which is why it went undetected for a while. I just pushed an update to fix this. It is version 2.2.12.

    Secondly, tweak your JS just a little to have it rotate:

    <script type="text/javascript" src="http://www.visionsofheaven.com/_aatest/wp-content/plugins/hms-testimonials/js.php?template=13&order=random&direction=ASC&char_limit=500&seconds=20&rotating=true”></script>

    I added &rotating=true on the end of it.

    Let me know if this fixes your issue.

    Jeff

  5. spirittlk
    Member
    Posted 1 year ago #

    Hi Jeff, Still not working :) I'm sorry! I can go into the code and click the link to js.php file and it takes me there, but nothing is showing up. Sorry to be a problem child. Should I just wait for the update? And is it true the js will load the testimonials faster? If not I can just go back to the shortcode possibly. Thank you!

  6. Jeff K
    Member
    Plugin Author

    Posted 1 year ago #

    Hey Ann,

    You do need to download the update as it fixes an issue specifically with the JavaScript. I believe WordPress checks for updates every 12 hours or so it should show up sometime soon.

    The testimonials won't load faster but your page might. Since they are far enough down the page they should get loaded before a visitor notices.

    Jeff

  7. spirittlk
    Member
    Posted 1 year ago #

    It works! Thank you - the new version is perfect!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • HMS Testimonials
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.