Forums

Quotes Collection
Get id of displayed quote (2 posts)

  1. TuneInTokyo
    Member
    Posted 5 months ago #

    Is there any way to get the id of the quote that is currently being displayed?

    I'm using quotescollection_quote() in my template.
    Before the quote, i want to have:
    "Quote No. X"

    http://wordpress.org/extend/plugins/quotes-collection/

  2. TuneInTokyo
    Member
    Posted 5 months ago #

    I have found a workaround by directly querying the database, but i would prefer not to have to do this.

    My solution:

    $offset = $wpdb->get_var("SELECT FLOOR(RAND() * COUNT(*)) FROM wp_quotescollection");
    $random_quote = $wpdb->get_row("SELECT * FROM wp_quotescollection LIMIT $offset, 1");

    Then i can echo $random_quote->quote_id etc.

Reply

You must log in to post.

About this Plugin

About this Topic