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"
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"
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.
You must log in to post.