
Contents
What are Shortcodes?
The content management system running this website has several features that can make the website’s content dynamic. By “dynamic” we mean “content that can change itself to keep up to date”.
For example: the menus change themselves depending on content added to the site. The calendar of events page updates depending on the events available.
A shortcode is an example of such dynamic content. A shortcode is a recognised command in square brackets ([fparc_findus]) that populates itself when your post is viewed.
Example: Referring to a Committee Member’s Name
Occasionally you’ll need to refer to dynamic content in your post. As an example, you may need to refer to a committee member by name (eg “Contact our Examination Secretary: John G4XXX”); but what happens when someone new takes the role? We’d rather not have to go into every post and change the person’s name. So instead of writing the person’s name, you’ll write some code that asks the website to figure out what the person;s name should be. The code looks like this:
Please contact our Examination Secretary: [FPARC_User role="Examination Secretary"]
Here’s what this looks like when the code executes on your page (this page!):
Please contact our Examination Secretary: Geoff G4XMJ
.., and the code within the square brackets [ ] instructs the website to find the current Examination Secretary’s name, the place the name into your text (using the default format (Firstname and Callsign)).
Available Shortcodes
Display a Committee Member’s name
[FPARC_User style="display_name|user_login|firstname|lastname" role="Honorary Chair|Membership Secretary|etc **see list of committee roles available in the committee Role field of a user profile" limit=1]
Looks through the user table and returns a string of names (formatted by the style field) that are currently assigned to the role).
Example
Please contact our Examination Secretary: [FPARC_User style="firstname" role="Examination Secretary"].
Result
Please contact our Examination Secretary: Graham.
Club’s address and location
[fparc_findus]
Displays a neatly formatted address and map.
Result
Fort Purbrook Amateur Radio Club (FPARC).
c/o Peter Ashley Activity Centres (Fort Purbrook),
Peter Ashley Lane, Portsdown Hill Road,
Portsmouth, Hampshire,
PO6 1BJ, United Kingdom.
π Free car parking outside of the Fort.
π Bus stops on Crookhorn Lane for #20 and #7 theSTAR.
Contact π§: https://fparc.uk/contact/
Note π: field events are held at the fort, and club meetings are held at Deverell Hall. The location for an event will be displayed on the event's page.
Make a Quotation/Notice Stand Out
[FPARC_Brotherton type="blue|red|green" align="right|left|center" heading="A Heading" signature="A Signature" ] A Brief Quotation / Content [/FPARC_Brotherton]
NB:
- If the type of the feature is not red (an alert notice) or green (um – don’t know!) don’t include the parameter; the notice will default to blue.
- The alignment “left” & “right” only works when viewed on a desktop or tablet sized screen; smartphones (etc) are narrow and so the feature will change to being center aligned.
- It’s important that the shortcode is closed with [[/FPARC_Brotherton]] or else WordPress won’t know how much of your page’s text to include in the visual element.
Example
[FPARC_Brotherton type="green" align="right" heading="Special Offer!" signature="FPARC Committee" ] This is an example of a special offer – with instructions on how to claim the deal. [/FPARC_Brotherton]
Result
Special Offer!
This is an example of a special offer β with instructions on how to claim the deal.
FPARC Committee
0 Comments