Dynamic Templating

From version 3.2 of the plugin, dynamic templating can be enabled via a backend option setting called “Handle WordPress Templates“. Watch this video to grab the basics:

Here is a comprehensive list of the shortcodes you can use in dynamic templates.

Shortcodes for Single & Archive templates:

[lc_the_title]

Returns the post title.

Attributes:

  • link (defaults to 0): Set to 1 to have the article title wrapped with a link to the single post.
  • link_class The CSS class to apply to each link

Examples:

[lc_the_title link=0]
[lc_the_title link=1 link_class="link-secondary"]

[lc_the_content]

Returns the post content.

Examples:

[lc_the_content]

[lc_edit_post_link]

Returns the post edit link.

Examples:

[lc_edit_post_link class="btn btn-danger btn-sm my-5"]

[lc_the_id]

Returns the post ID.

Examples:

[lc_the_id]

[lc_the_date]

Returns the post date.

Examples:

[lc_the_date]

[lc_the_time]

Returns the post time.

Examples:

[lc_the_time]

 

[lc_the_author]

Returns the author fields.

Attributes:

  • field (defaults to display_name). Accepted values for the field parameter:
    • admin_color
    • aim
    • comment_shortcuts
    • description
    • display_name
    • first_name
    • ID
    • jabber
    • last_name
    • nickname
    • plugins_last_view
    • plugins_per_page
    • rich_editing
    • syntax_highlighting
    • user_activation_key
    • user_description
    • user_email
    • user_firstname
    • user_lastname
    • user_level
    • user_login
    • user_nicename
    • user_pass
    • user_registered
    • user_status
    • user_url
    • yim

[lc_the_avatar]

Returns the author avatar.

Attributes:

  • size (defaults to 96) Desired image size
  • class CSS class to apply to the image tag
  • placeholder_url The URL of the desired placeholder image

[lc_the_author_posts_url]

Returns the author posts URL.

[lc_the_permalink]

Returns the post URL.

[lc_the_previous_post_link]

Returns the previous post URL as per get_previous_post_link

Attributes:

  • format:  (defaults to %link ») Link anchor format
  • link (defaults ‘%title’. ) The permalink format.
  • in_same_term (defaults to false) Whether link should be in a same taxonomy term.
  • excluded_terms comma-separated list of excluded term IDs to exclude
  • taxonomy (defaults to category) Taxonomy, if $in_same_term is true.
  • class The CSS class to apply to the link

handling the very same parameters as attributes.

[lc_the_next_post_link]

Returns the next post URL as per get_next_post_link

Attributes:

  • format:  (defaults to %link ») Link anchor format
  • link (defaults ‘%title’. ) The permalink format.
  • in_same_term (defaults to false) Whether link should be in a same taxonomy term.
  • excluded_terms comma-separated list of excluded term IDs to exclude
  • taxonomy (defaults to category) Taxonomy, if $in_same_term is true.
  • class The CSS class to apply to the link

[lc_the_terms]

Returns the post terms.

Attributes:

  • taxonomy (defaults to category)
  • link (defaults to 1) Set to 0 if you just want to display the post term, without linking it
  • class (defaults to ‘badge rounded-pill bg-secondary’) The CSS class to apply to each tag
  • link_class The CSS class to apply to each link
  • prefix The text that should be printed before the output, if any output is present
  • suffix The text that should be printed after the output, if any output is present

[lc_the_categories ]

Returns the post categories. It uses lc_the_terms internally.

Attributes:

  • link (defaults to 1) Set to 0 if you just want to display the post term, without linking it
  • class (defaults to ‘badge rounded-pill bg-warning’) The CSS class to apply to each tag
  • link_class The CSS class to apply to each link
  • prefix The text that should be printed before the output, if any output is present
  • suffix The text that should be printed after the output, if any output is present

[lc_the_tags]

Returns the post tags. It uses lc_the_terms internally.

Attributes:

  • link (defaults to 1) Set to 0 if you just want to display the post term, without linking it
  • class (defaults to ‘badge rounded-pill bg-info’) The CSS class to apply to each tag
  • link_class The CSS class to apply to each link
  • prefix The text that should be printed before the output, if any output is present
  • suffix The text that should be printed after the output, if any output is present

[lc_the_cf]

Returns the value of a given custom field. If no value is present, nothing will be returned.

Attributes:

  • field Name of the Custom field to retrieve
  • filter Optional name of a function that should be applied to filter the field value
  • prefix The text that should be printed before the output, if any output is present
  • suffix The text that should be printed after the output, if any output is present
  • output  (Defaults to “span”) Controls how data is displayed. Possible values:
    • “span”: wraps prefix, custom field value, and suffix in individual span tags
    • “raw” : outputs the raw value only, without any wrapper tag
    • “a”  creates an a tag using the custom field value as href attribute value. Useful to make a link / button
  • class Set the class of the main span (or a) tag.
  • prefix_class Set the class attribute of the prefix span tag.
  • suffix_class Set the class attribute of the suffix span tag.
  • anchor_text (defaults to ‘More Details…’) Sets the link anchor text. Is only relevant is output is set to “link”
  • target (defaults to ”) The target attribute of the a. Set to _blank to open in a new window.
  • title (defaults to ”) The title attribute.

Examples:

Simple example: [lc_the_cf field="YOURFIELDNAMEHERE"]
Button example: [lc_the_cf field="url" output="a" anchor_text="Open URL" class="btn btn-warning me-3" target="_blank"]

[lc_the_thumbnail]

Returns the featured image (thumbnail) of a post.

Attributes:

  • size (defaults to ‘post-thumbnail’) Desired image format
  • class CSS class to apply to the image tag
  • style Inline style to apply to the image tag
  • placeholder (defaults to 1) Set to 0 to disable the placeholder image which is shown when no image is present
  • placeholder_url The URL of the desired placeholder image

[lc_the_thumbnail_url]

Returns the URL of the featured image (thumbnail) of a post.

Attributes:

  • size (defaults to ‘post-thumbnail’) Desired image format
  • placeholder (defaults to 1) Set to 0 to disable the placeholder image which is shown when no image is present
  • placeholder_url The URL of the desired placeholder image

[lc_the_sharing]

Returns post sharing buttons for FaceBook, WhatsApp, Telegram, Twitter.

[lc_the_comments_number]

Returns the number of comments. Uses the get_comments_number WordPress function.

[lc_the_comments]

Returns the  comments form.

[lc_widgetsarea]

Returns the sidebar widget area.

Attributes:

  • id (defaults to ‘main-sidebar’) Desired widgeted area

 

Shortcodes for Archive templates

[lc_loop] … [/lc_loop]

Returns the link for post editing, if user has the rights to do so

[lc_the_excerpt]

Returns the article excerpt

Attributes:

  • link (defaults to 1). If a button / link to the article should be present
  • length (defaults to 1). Number of words before the cut is applied

[lc_the_archive_title]

Returns the archive title

[lc_the_archive_description]

Returns the category / archive description

[lc_the_pagination]

Returns the pagination

[lc_the_search_query]

Useful for the Search results page. Returns the  current searched string.

[lc_get_template_part]

Returns the template partial file in the theme/child theme folder

Attributes:

  • slug Name of the template file to grab, as in the get_template_part WordPress function