The Certificate Link shortcode and block put a button on a course, lesson, topic, quiz, or assignment page that opens the user’s own certificate for that item. Learners who have not earned it see nothing at all.
Adding the Link
Add the Certificate Link block from the block inserter, or use this shortcode:
[ppcert_certificate_link]
Both produce the same output. Dropped onto a LearnDash course page with no settings changed, either one shows a View your certificate button to learners who hold a certificate for that course, and nothing to anyone else. The block’s sidebar exposes every option below; the shortcode takes them as attributes.
What the Learner Sees
The link renders only when there is something to link to. It stays hidden when:
- the visitor is not signed in,
- the learner has not earned a certificate for this item yet, or
- the only matching certificate has been revoked.
An expired certificate still shows; it exists and it is theirs. If a learner has earned the certificate more than once, the newest one is linked. When the link is hidden, nothing is output at all, not even an empty container, so it never leaves a gap on the page.
You can add a message that appears in a panel above the button. Because the panel only renders with the button, it is safe to write something like “Congratulations on completing the course! Download your certificate below.” without worrying about learners who are still working through the course.
Which Certificate It Finds
By default the link looks for a certificate earned for the page it sits on. On a course, lesson, topic, or LMS quiz page, that means certificates awarded for that course, lesson, topic, or quiz. On any page that contains a PressPrimer Quiz or PressPrimer Assignment, it also matches certificates awarded for that quiz or assignment.
Two other scopes are available:
- A specific quiz, assignment, or post. Give the ID of the item the certificate was earned for, and the link works from any page. For a course, lesson, topic, or LMS quiz, this is the post ID. For a PressPrimer quiz or assignment, it is the ID shown in its list in the admin, and because those are not posts you also tell the block which kind of ID it is.
- Not scoped to a page (use the template). Skip the item altogether and link the learner’s newest certificate from one template, wherever it was earned. This suits a member dashboard with a “Your Safety Certification” button.
Choosing a template alongside a page or item scope narrows the match further to certificates from that template only.
Shortcode Attributes
Every block setting has a shortcode equivalent. All attributes are optional.
| Attribute | Values | What it does |
|---|---|---|
source | current, none, or an ID | Where the certificate was earned. Defaults to current (the page the shortcode is on), or to none when template is set. |
source_type | ppq_quiz or ppa_assignment | The kind of ID given in source. Needed only for a PressPrimer quiz or assignment ID; post IDs are detected on their own. |
template | A template ID | Narrows the match to certificates from one template. Required when source is none. |
action | view, download, verify | Where the button goes: the certificate page, the PDF (default), or the verification page. |
text | Any text | The button label. Defaults to “View your certificate”, “Download your certificate”, or “Verify your certificate” to match the action. |
message | Any text | A message shown in a panel above the button, only when the button shows. |
style | button or link | A styled button (default) or a plain text link. |
new_tab | true or false | Open in a new tab. Defaults to true for verify and false otherwise. |
The recipient is always the signed-in visitor. There is no attribute to show someone else’s certificate.
Examples
A download button with a message, on the course page itself:
[ppcert_certificate_link action="download" message="Congratulations on completing the course! Download your certificate below."]
A button for a PressPrimer quiz with ID 12, placed on a page that does not contain the quiz:
[ppcert_certificate_link source="12" source_type="ppq_quiz"]
A plain text link on a member dashboard to the learner’s newest certificate from template 5, wherever it was earned:
[ppcert_certificate_link template="5" style="link" text="Your Safety Certification"]
Troubleshooting
- Nothing shows, even for you. Check the three conditions above: signed in, certificate earned for this exact item, and not revoked. Then check that the certificate was awarded for the item on this page and not, say, for the course when the link is on a lesson.
- Nothing shows on a page with a PressPrimer quiz on it. The quiz must be placed with its block or shortcode for the link to detect it. If it is embedded another way, set
sourceto the quiz ID andsource_typetoppq_quiz. - The wrong certificate is linked. Add
templateto narrow the match, or setsourceandsource_typeexplicitly instead of relying on the page. - The button looks different from your theme’s buttons. Use
style="link"for a plain link, or target the.ppcert-certificate-linkclass in your theme’s CSS.
For the other front-end blocks and shortcodes (verification form, My Certificates list), see Shortcodes and Blocks. For what the learner finds once they click through, see The Student Experience.
