You can use shortcodes to display a giveaway, leaderboard or winners of a giveaway.
We have this shortcodes:
- [giveaway]
- [giveaway_winners]
- [giveaway_leaderboard]
Giveaway
To use the shortcode [giveaway] you will need to provide the ID of the giveaway as the attribute id. Other attributes are optional, and in the following table you can see all the available attributes.
Attribute | Description |
---|---|
id | The Giveaway ID. Required. |
description | Short description to show in the giveaway. |
title | Show title or not. Default: 1. Options: 1 or 0. |
redirect | Where should the subscriber be redirected after a successful signup. Default: self. Options: – self – Redirect to the same page – giveaway – Redirect to the giveaway landing page – any url – if a url is set, it will be used to redirect (example: https://wpsimplegiveaways.com) |
images | Show images added to the Giveaway or not. Default: 0. If 1, it will show, 0 will hide it. |
use_link | Link the title to the main giveaway landing page. Default: 1. If 0, it won’t. |
prizes | Show all the defined prizes. Default: 1. If 0, it won’t show them. |
show_form | Show the form. Default: 1. If 0, it won’t show the form or actions. |
only_form | Show only the form and actions. Default: 0. If 1, it will show only the form and actions. |
show_total_entries | If set to 1, it will show the total entries in the header. |
show_entries | If set to 1, it will show your current entries in the header. |
countdown_in_header | If set to 1, it will show a shortened countdown in the header. |
hide_winners_number | If set to 1, it will hide the number of winners in the header. |
hide_prize_value | If set to 1, it will hide the prize value in the header. |
hide_prize_title | If set to 1, it will hide the prize title in the header. |
content | If set to 1, it will show the whole content of the Giveaway. |
Here is how the shortcode header will look if you hide the previous data and you show entries and countdown.
Giveaway Leaderboard
This shortcode can be used to show who is in the top with their entries. Each list is saved in cache for 12 hours. If you want to refresh it before the 12 hours, go to the giveaway for which you are showing the leaderboard and just click “Update”.
Attribute | Description |
---|---|
id | The Giveaway ID. Required. |
limit | How much subscribers will we show. Default: 10. |
order | How are we order the entries. Default: DESC. If ASC, it will show lower first. |
orderby | By which columns are we going to order it. Default: entries. Options: entries, email, id, status, |
columns | Which columns to show. If column entered is not in the table, it will try to get it from the meta data. Default: entries,email. Use field keys from the Form to get other data displayed. No spaces allowed. |
headers | The headers for the columns. Default: Entries,Email No spaces allowed. |
Example:
Leaderboard where we want to show Entries, Email and Name (Name is saved as field key user_name).
[giveaway_leaderboard id=49 columns=entries,email,user_name headers=Entries,Email,Name ]