Welcome to our Knowledge Base
Categories
< All Topics
Print

Button Shortcodes

With the PRO version of WPComplete, you can use all the shortcodes, including the above code for manually adding a button to any type of content. You can also add several buttons to the same page, using “name”, like so:

[wpc_button name="button-one"]

You can also show the button from another lesson on your content by using “post”, such as:

[wpc_button post="345"]

You can also change the words on the buttons on a per-button basis (you can change them globally on the settings page):

[wpc_button text="Click me to complete!" completed_text="YAY! Completed"]

If you have a caching plugin present, you can try to add this to your shortcodes if they are caching your button (or any of our shortcode):

[wpc_button async="true"]

If you want one specific button to redirect to one specific URL, you can do that via our shortcode. You do have to ensure you have the full ‘https://’ in the URL, like so:

[wpc_button redirect="https://wpcomplete.co"]

You can also filter listing pages by tag or by category (if your lessons are posts or a custom post type that use the “type” of “post”):

The available commands you can use for categories:

  • cat (int) – use category id.
  • category_name (string) – use category slug.
  • category__and (array) – use category id.
  • category__in (array) – use category id.
  • category__not_in (array) – use category id.

The available commands you can use for tags:

  • tag (string) – use tag slug.
  • tag_id (int) – use tag id.
  • tag__and (array) – use tag ids.
  • tag__in (array) – use tag ids.
  • tag__not_in (array) – use tag ids.
  • tag_slug__and (array) – use tag slugs.
  • tag_slug__in (array) – use tag slugs.

For example, to show all lessons with a category of “module1” you’d use:

[wpc_list_pages category_name="module1"]

If you wanted to show all lessons with a tag of “intro”, you’d use:

[wpc_list_pages tag="intro"]

If you wanted to show all lessons, except ones tagged as “intro”, where the intro tag had an ID of 34, you’d use:

[wpc_list_pages tag__not_in="34"]

If you want to have an “invisible button”, which can be completed manually through javascript, but that doesn’t show up on a users screen, you’d use:

[wpc_button hidden="true"]

If you want to have a button which auto-completes when a page is loaded (not when the button is clicked), you’d use:

[wpc_button autocomplete="true"]

And of course, you can combine hidden and autocomplete, so you could have a lesson where no button is shown, but it autocompletes by using:

[wpc_button hidden="true" autocomplete="true"]

You can now add any CSS you’d like to [wpc_button] by adding a style modifier to our shortcode.

For example: [wpc_button style=”background: blue;”] would make just that one button have a blue background, just for this specific instance of the button (not for all instances).

You can add any CSS you’d like within style=”” for your buttons!

Table of Contents