Author: theadmin

  • Custom Taxonomy Shortcode

    🧩 Plugin: Custom Taxonomy Shortcode

    Displays terms from any taxonomy (Tags, Categories, or custom) via shortcode.

    🔧 Shortcode

    [taxonomy_terms taxonomy="taxonomy_name"]

    ✅ Supported Attributes

    AttributeDescription
    taxonomy(Required) Taxonomy slug (e.g. post_tag, category, collaborators).
    post_id(Optional) Post ID. Defaults to the current post.
    defaultFallback if no terms exist.
    before / afterHTML/text to wrap the output.
    eschtml (default), attr, or raw.
    nl2brConvert newlines to <br>. Defaults to true.
    separatorString to join items. Default is <br>.
    linktrue makes each term a hyperlink to its archive.

    🧪 Examples

    Tags (built-in):

    [taxonomy_terms taxonomy="post_tag" separator=", " link="true"]

    Categories (built-in):

    [taxonomy_terms taxonomy="category" separator=" / "]

    Custom taxonomy (e.g. collaborators):

    [taxonomy_terms taxonomy="collaborators" separator="<br>"]

    🧠 Template Function

    echo cts_get( 'collaborators', [
      'separator' => ', ',
      'link' => 'true',
      'default' => 'No collaborators'
    ]);
  • Custom Field Shortcode

    📦 Plugin: Custom Field Shortcode

    Displays post meta (custom fields) via shortcode. Designed for block themes like Twenty Twenty-Five.

    🔧 Shortcode

    [custom_field field="your_custom_field_key"]

    ✅ Supported Attributes

    AttributeDescription
    field(Required) The custom field (meta key) name.
    post_id(Optional) Post ID to pull the value from. Defaults to the current post.
    defaultFallback if the custom field is empty.
    before / afterHTML or text to wrap the output.
    escEscaping mode: html (default), attr, or raw.
    nl2brConvert newlines to <br>. Defaults to true.
    separatorIf the field is an array or multiline text, this joins items (e.g., , ).

    🧪 Examples

    [custom_field field="bio"]
    [custom_field field="skills" separator=", "]
    [custom_field field="team_members" separator=" / " before="<p>" after="</p>"]

    🧠 Template Function

    echo cfs_get( 'skills', [
      'separator' => ', ',
      'default' => 'No skills listed'
    ]);
  • Simple File Download with Hidden URL

    ⬇️ Plugin: Simple File Download with Hidden URL

    Adds a shortcode to generate download links for media attachments without revealing the real file URL. The download is streamed via a masked query parameter.

    🔧 Shortcode

    [media-download media_id="123" texts="Download File" image_url="" class=""]

    ✅ Supported Attributes

    AttributeDescription
    media_id(Required) The attachment ID to download. You can find this in the Media Library (click the item and check the URL).
    textsAnchor text for the link (ignored if image_url is set).
    image_urlURL of an image to use as the link content (replaces texts). Useful for a download icon/button image.
    classOptional CSS class for styling the anchor.

    🧪 Examples

    Basic text link:

    [media-download media_id="123" texts="Download PDF"]

    Image as link (icon/button):

    [media-download media_id="123" image_url="https://example.com/wp-content/uploads/download-icon.png" class="btn-download"]

    Styled link with a custom class:

    [media-download media_id="123" texts="Get the ZIP" class="button is-primary"]

    🧠 How it works

    The shortcode outputs an anchor to a masked URL like /?media_dl=123. On page load, the plugin intercepts requests with that query parameter and streams the file contents to the browser with download headers. The real filesystem path is never exposed in the link HTML.

    🔒 Notes

    • Only attachment files in your Media Library can be downloaded (uses the attachment ID).
    • Default supported Content-Types: pdf, zip, jpeg/jpg. Others are sent as application/force-download with attachment disposition.
    • Make sure there is no output before headers (themes/plugins that echo early can break downloads).