Welcome to our Knowledge Base
Categories
< All Topics
Print

Conditional Content

Conditional content shortcodes allow WPComplete users to show or hide content based on student progress. These shortcodes can respond to button, page, or course completion, and are especially useful for dashboards, summaries, or creating personalized learning paths.

Button-Based Conditionals

  • Show content only if a button is completed:
[wpc_completed_content]</span></span><span>Your custom </span><span><span class="hljs-attribute">content</span></span><span> here</span><span><span class="hljs-selector-attr">[/wpc_completed_content]

Show content only if a button is incomplete:

[wpc_incomplete_content]</span></span><span>Your custom </span><span><span class="hljs-attribute">content</span></span><span> here</span><span><span class="hljs-selector-attr">[/wpc_incomplete_content]

Target a specific button:

[wpc_completed_content name="button-one"]Shown if 'button-one' is completed[/wpc_completed_content]

Combine button name with a page/post ID:

[wpc_incomplete_content name="button-one" post="435"]Shown only if 'button-one' on post 435 is incomplete[/wpc_incomplete_content]

Page/Post-Based Conditionals

  • Show content if all buttons on the current page are completed: [wpc_if_page_completed]This page is completed![/wpc_if_page_completed]
  • Show content if any buttons on the current page are incomplete: [wpc_if_page_incomplete]This page is not yet complete[/wpc_if_page_incomplete]
  • Target a specific page/post ID: [wpc_if_page_completed post="123"]Page 123 is completed![/wpc_if_page_completed]

Course-Based Conditionals

Show content when a specific course is completed:

[wpc_if_page_completed]This page is completed![/wpc_if_page_completed]

Show content when a specific course is incomplete:

[wpc_incomplete_content course="Course Name"]Course not completed yet[/wpc_incomplete_content]

Check completion for the current course:

[wpc_if_course_completed]You’ve completed this course![/wpc_if_course_completed]  
[wpc_if_course_incomplete]You have not completed this course[/wpc_if_course_incomplete]

Specify a course with advanced options:

[wpc_if_course_completed course="Course Name" async="true" hide="true"]Congrats on finishing![/wpc_if_course_completed]

Next/Previous Page Conditionals (WPComplete v2.9+)

Show no post completed:

[wpc_has_no_last_completed]Start your learning journey![/wpc_has_no_last_completed]

Show next lesson:

[wpc_has_next_to_complete]Next lesson is available![/wpc_has_next_to_complete]

Check for next lessons:

[wpc_has_next_to_complete]Next lesson is available![/wpc_has_next_to_complete]

Show no next lesson:

[wpc_has_no_next_to_complete]You’ve reached the final lesson![/wpc_has_no_next_to_complete]

Show last post completed:

[wpc_has_last_completed]You finished the last item[/wpc_has_last_completed]

Navigation-specific conditionals:

[wpc_has_next_page]You have more lessons ahead[/wpc_has_next_page]
[wpc_has_no_next_page]No further lessons[/wpc_has_no_next_page]
[wpc_has_previous_page]Go back to earlier content[/wpc_has_previous_page]
[wpc_has_no_previous_page]This is your first lesson[/wpc_has_no_previous_page]

Button Status Conditionals

Show content if a button is completed:

[wpc_if_button_completed]Completed![/wpc_if_button_completed]

Show content if a button is incomplete:

[wpc_if_button_incomplete]Still needs to be completed[/wpc_if_button_incomplete]

Target a specific button and page/post ID with advanced options:

[wpc_if_button_completed post="123" name="Button Name" async="true" hide="true"]Nice work![/wpc_if_button_completed]

Advanced Options

  • hide="true"
    Prevents conditional content from being included in the page’s HTML when the condition is not met.
    Supported in:
    • wpc_if_button_completed
    • wpc_if_button_incomplete
    • wpc_if_page_completed
    • wpc_if_page_incomplete
    • wpc_if_course_completed
    • wpc_if_course_incomplete
  • async="true"
    Helps bypass caching issues by checking user progress in real-time.
    Supported in the same shortcodes as hide.

Linking to the Next Lesson

The [wpc_next_to_complete] shortcode can be used to link directly to the next lesson:

  • As a clickable link: <a href="[wpc_next_to_complete link='true']">Next Lesson</a>
  • Return JSON (for custom scripts): [wpc_next_to_complete json="true"]

Conclusion

Conditional content shortcodes provide flexible ways to personalize learning experiences. By combining attributes such as post, course, name, async, and hide, course creators can create dynamic pathways that guide learners through lessons, pages, and courses based on real-time progress.

Table of Contents