Mecha CMS

Mecha CMS blog and documentation.

Dynamic Tags

Updated: Sunday, 07 August 2016

Creating dynamic tags from a file.

You can add more tags dynamically by creating a file named as tags.php, stored in a folder named as workers. This applies to shields and plugins:

Example for shield:

your-shield-name/
 ├── workers/
 │   └── tags.php
 ├── …
 ├── …
 └── …

Example for plugin:

your-plugin-name/
 ├── workers/
 │   └── tags.php
 ├── about.txt
 └── launch.php

The tags.php file only contains array of tags data:

<?php

return array(
    21 => array(
        'name' => 'Such Tag',
        'slug' => 'very-slug',
        'description' => 'Wow!',
        'scope' => 'article'
    ),
    22 => array(
        'name' => 'Many Tag',
        'slug' => 'such-slug',
        'description' => 'Wat!',
        'scope' => 'article'
    )
);

The tags data above will be added to the post editor automatically so that you don’t have to tell the users to add such required tags manually from the Tags manager.

Donation and Email Subscription