πŸ’»Overview Menu

Shortcodes in WordPress are a powerful tool for non-technical users to easily add predefined functionality or content to their website. They are written in brackets, for example [this], and can be used to add elements such as images, forms, and other media to a website without the need for coding knowledge. The use of shortcodes in our voting contest plugin offers a wide range of customization options for users to create their own unique contest. It's important to note that when using shortcodes, the default settings will be overridden, so it's best to utilize global settings and minimize the use of variables to keep your code concise.

Short Code: showcontestants

Description:

The showcontestants short code displays a list of contestants on a page. The contestants can be filtered by category, sorted by various parameters, and displayed with or without a thumbnail image. The short code also supports pagination and grid/list view switching.

Options:

  • id (int): The ID of the category to filter contestants by.

  • thumb (int): Whether to display the thumbnail image of the contestant (1) or not (0).

  • height (int): The height of the thumbnail image in pixels.

  • width (int): The width of the thumbnail image in pixels.

  • title (string): The title of the contest listing. If not specified, the page title will be used.

  • termdisplay (int): Whether to display the category title that the contestant is assigned to (1) or not (0).

  • order (string): The sort order for the contestants. Can be set to 'ASC' for ascending order or 'DESC' for descending order. Default is 'DESC'.

  • orderby (string): The parameter to sort the contestants by. Can be set to 'votes', 'ID', 'author', 'title', 'name', 'date', 'modified', 'parent', 'rand', 'comment_count', 'menu_order'. Default is 'date'.

  • postperpage (int): The number of contestants to show per page. Set to -1 to show all contestants.

  • pagination (int): Whether to show pagination (1) or not (0).

  • view (string): The view mode for the contestants. Can be set to 'list' or 'grid'.

  • exclude (int): Comma-separated list of contestant IDs to exclude from the listing.

  • showtimer (int): Whether to show the start or end timer (1) or not (0). Default is 1.

  • showform (int): Whether to show the entry form (1) or not (0) based on the start timer setting.

  • navbar (int): Whether to show the navigation bar (1) or not (0). Default is 1.

Examples:

[showcontestants id=2 postperpage=15 thumb=1 height=150 width=200 title='Contestants' termdisplay=1 order='ASC' orderby='votes' view='grid' pagination=1 showtimer=1 showform=1 navbar=1]

  • This will display a grid of contestants from category ID 2, showing 15 contestants per page. The thumbnail image will be displayed with a height of 150 pixels and width of 200 pixels. The title of the listing will be 'Contestants', and the category title will be displayed. The contestants will be sorted in ascending order by the number of votes they have received. Pagination will be shown, along with the start or end timer, entry form, and navigation bar.

[showcontestants id=4 postperpage=-1 thumb=0 title='All Contestants' order='ASC' orderby='date' view='list' exclude=7,23,35 showtimer=0 showform=0 navbar=0]

  • This will display a list of all contestants from category ID 4. The thumbnail image will not be displayed. The title

Short Code: showallcontestants

Description:

The "showallcontestants" shortcode is a completely new layout and view for displaying all the contestants on a single page from all contest categories. With this view only, you can search for contestants and filter by category.

Options:

  • orderby (string): The parameter to sort the contestants by. Can be set to 'none','votes', 'ID', 'author', 'title', 'name', 'date', 'modified', 'parent', 'rand', 'comment_count', 'menu_order'. Default is 'date'.

  • order (string): The sort order for the contestants. Can be set to 'ASC' for ascending order or 'DESC' for descending order. Default is 'DESC'.

  • postperpage (int): The number of contestants to show per page. Set to -1 to show all contestants.

Examples:

[showallcontestants orderby='votes' order='ASC' postperpage=8]

  • This will show all contestants from all categories, sorted in ascending order by the number of votes they have received, and 8 contestants per page.

[showallcontestants orderby='title' order='DESC' postperpage=-1]

  • This will show all contestants from all categories, sorted in descending order by title of the contestants, and shows all contestants in a single page.

Short Code: addcontestants

Description:

The "addcontestants" shortcode displays the Contestants entry form, and allows contestants to be added to a contest by specifying a category ID.

Options:

  • id (int): The ID of the category to add contestants to.

  • showcontestants (int): Whether to display the contestants in the contest listing (1) or not (0). If set to 0, only the form will be shown.

  • displayform (int): Whether to display the entry form (1) or not (0). This attribute overrides the default form settings based on the start time.

  • showrules (int): Whether to display the Rules and Prizes tab (1) or not (0).

Examples:

[addcontestants id=3 showcontestants=1 displayform=1 showrules=1]

  • This will show the entry form for adding contestants to category ID 3, along with the list of approved contestants and Rules and Prizes tab.

[addcontestants id=5 showcontestants=0 displayform=1 showrules=0]

  • This will show the entry form for adding contestants to category ID 5, without showing the list of approved contestants or Rules and Prizes tab.

Short Code: addcontest

Description:

The "addcontest" shortcode allows you to show a single entry form to enter all of your contests. This shortcode will not allow you to show the contestants listing.

Basic Use:

[addcontest]

Attributes:

There are no attributes available for this shortcode.

Short Code: upcomingcontestants

Description:

The "upcomingcontestants" shortcode displays the upcoming contestants for a specified contest category, using the contest category ID.

Basic Use:

[upcomingcontestants id=42] (Note: Replace the ID # 42 with the ID of the contest category you want to display.)

Attributes:

  • id (int): Specifies the category of the post for which the start timer will be displayed.

  • showcontestants (int): Specifies whether to display the contestants (1) or not (0).

Short Code: endcontestants

Description:

The "endcontestants" shortcode is used to display only the contestants from contests that have already ended.

Basic Use:

[endcontestants id=42] (Note: Replace the ID # 42 with the ID of the contest category you want to display.)

Attributes:

  • id (int): Specifies the category of the post for which the end timer will be displayed.

Short Code: profilescreen

Basic Use:

[profilescreen]

Advanced Use:

[profilescreen contests=1 postperpage=20 form=1]

Description:

The "profilescreen" shortcode is used when you require a contestant to register/login to enter a contest. This shortcode allows contestants to view, edit, and delete their own entries after they've logged in.

Attributes:

  • contests (int): Display (1) or hide (0) the contestant's entries on the profile screen.

  • postperpage (int): Specifies the number of entries to be displayed per page on the profile screen. Maximum allowed is 500.

  • form (int): Enable (1) or disable (0) editing of contestants on the profile screen. You can use this shortcode in a page where users have to login and it will show the users their entries, also you can use the attributes to display number of entries per page, hide or show entries and enable/disable editing on the profile screen as well.

Short Code: topcontestants

Description:

The "topcontestants" shortcode is used to display only the contestants from contests that received high number of votes during the contest.

Basic Use:

[topcontestants id=6] (Note: Replace the ID # 6 with the ID of the contest category you want to display)

Attributes:

  • id (int): Specifies the category of the post for which the high voted contestants will be displayed.

  • showcount (int): Specifies the maximum number of high voted contestants to be displayed. It's useful to mention that this shortcode is to show the contestants that got high votes during the contest, in a specific category, the id attribute is used to specify the category, the showcount attribute is used to limit the number of contestants to be shown.

Short Code: logincontest

Description:

The "logincontest" shortcode is used to display the login form for users.

Basic Use:

[logincontest]

Attributes:

There are no attributes available for this shortcode. It's a simple shortcode and no attributes available, it's used to display the login form and allow the users to login.

Last updated