• Resolved mike121212

    (@mike121212)


    Hello,

    I’ve posted the “random” shortcode to a page on my site and it’s not changing the quote when the page is refreshed?

    I’ve tried this on safari and chrome.

    I’ve asked others if it was changing for them and they said it’s not. We are all seeing the same quote.

    Can you help me?

    Thanks,
    Mike

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Author oooorgle

    (@oooorgle)

    Hi Mike121212, my first wonder is if you have only a few quotes entered… If there are only a few quotes it often lands on the same one over and over.

    I assume you are using [quotes-llama] short-code in a page (not template) and that it is displaying a quote?

    Might you be able to provide a link where I can see it?

    Thread Starter mike121212

    (@mike121212)

    I have about 15 quotes.

    Yes, I am using [quotes-llama]. It does display a quote (very well) but the quote never changes.

    I am using Thrive Content Builder (it is displaying well). The page is protected with imember360.

    Not sure what to do next. We launch the new site Friday.

    I really appreciate your help.

    Plugin Author oooorgle

    (@oooorgle)

    Hmm, I’ve no idea if imember360 would be the cause or how it interacts with WordPress. I wonder, have you tried seeing what the widget looks like or perhaps the gallery or page modes? In your widgets you should see a “quotes llama” widget you can drag to your sidebar/footer etc which has it’s own options.

    Thread Starter mike121212

    (@mike121212)

    I have put the shortcode on a page that isn’t protected. It doesn’t work there either.

    It’s on a page. So I won’t have a sidebar.

    Should I deactivate and reactivate?

    Here is where you can see it.

    http://12weekyearcertification.com/test/

    Plugin Author oooorgle

    (@oooorgle)

    Yeah, try deactivating and reactivating.

    No widgets, try replacing [quotes-llama] with [quotes-llama mode="gallery"] and [quotes-llama mode="page"] This will hopefully at least show more than that one… as a test of course.

    • This reply was modified 9 years ago by oooorgle.
    Plugin Author oooorgle

    (@oooorgle)

    Are you using a page-cache plugin?

    Hi, I am having the same problem. I have entered ten quotes but only one is showing (interestingly, id=3 is the one that always shows). Here is the link:

    https://verobeach.wpengine.com/quotes/

    I have tried all of the suggestions above (deactivate and reactivate plugin, try gallery, clear cache, etc.).

    Any assistance would be appreciated. Thanks!

    Joe

    Plugin Author oooorgle

    (@oooorgle)

    Hi orangeaxis, attempting to replicate quotes like your example including the inline <br> seems to function ok on my testing site: http://oooorgle.com/test I’m also running a page-caching plugin which doesn’t seem to interfere with pulling a new quote, which is what it seemed to be doing.

    1. What short-code/s ([quotes-llama]) are you using?
    2. Is it being loaded in a Widget, Page or Post?
    3. Is your install of WP simply default or perhaps part of a multi-site?
    4. Are you running any plugins that perhaps you feel I should test to see if a conflict exists?

    This is really weird, I sure would like to figure it out. Thanks for the help!

    • This reply was modified 8 years, 11 months ago by oooorgle.

    Thanks for the quick follow-up. This site is on WP Engine, which has pretty aggressive caching. However, I’ve flushed the cache manually and am still seeing the issue.

    1. I am using [quotes-llama]
    2. Loaded in a page
    3. Single site (default)
    4. I don’t think so. It is a pretty vanilla WordPress site.

    I also tried the short-code in a post, but it also is only showing the one quote.

    I hope this helps, and thanks for all of your help 🙂

    Joe

    Plugin Author oooorgle

    (@oooorgle)

    I’ve gone through most everything I can think of on the WordPress side, so reading more on SQL I find it also has caching functionality for queries ( https://dev.mysql.com/doc/refman/5.6/en/query-cache-in-select.html ).

    I assume my MySQL has caching disabled and perhaps yours has it enabled, but not finding how to check that on mine yet. I really don’t want to update this without being able to verify but its seems it may be the issue. Perhaps you or mike121212 would be willing to test this? You would need to make a small edit of the quotes-llama.php file.

    On line 2539: $sql = "SELECT quote, first_name, last_name, source, img_url
    Changed to: $sql = "SELECT SQL_NO_CACHE quote, first_name, last_name, source, img_url

    Thanks!

    I made the change above, but it doesn’t appear to have remedied the issue.

    Joe

    Plugin Author oooorgle

    (@oooorgle)

    Thanks for testing that. I’ll get back when I have something… Suggestions from the WP community are welcome.

    You can try not to rely on the SQL RAND function. It is probably causing the runtime error of not displaying random quotes. This could be an idea:

    $sql = "SELECT COUNT(quotes_id) FROM " . $this->table_name;
    $record_count = $wpdb->get_var( $sql );	
    
    $random_id = mt_rand(1, $record_count);
    		
    $sql = "SELECT quote, first_name, last_name, source, img_url FROM " . $this->table_name . " WHERE quotes_id = " . $random_id;
    
    $quote_data = $wpdb->get_row( $sql, ARRAY_A );

    [Moderator note: code fixed. Please wrap code in the backtick character or use the code button.]

    • This reply was modified 8 years, 11 months ago by rehernandez.
    • This reply was modified 8 years, 11 months ago by bdbrown.
    • This reply was modified 8 years, 11 months ago by bdbrown.
    Plugin Author oooorgle

    (@oooorgle)

    Hi rehernandez! Thanks for the suggestion. My fingers are crossed it performs better.

    Plugin Author oooorgle

    (@oooorgle)

    Could someone who is having this problem try testing the changes suggested by rehernandez? Simply replace the quotes-llama.php file in the plugin directory with this one http://oooorgle.com/downloads/quotes_llama/quotes-llama.zip

    What it is basically doing is having PHP select the random quote rather than SQL. Be sure to clear your cache too ;). Thanks!

Viewing 15 replies - 1 through 15 (of 15 total)

The topic ‘Random Not Working?’ is closed to new replies.