Snippet · Mecha CMS

Code snippet collection for developers.

Site Backup System

Simple backup system for the panel extension.

Logo in the Log In Form

Add logo to the default log in system form.

Disable Page Hooks

Force to disable all hooks that should be applied to the given page property.

Inline Image to Base64 Converter

Making simple online tool with Mecha.

Fixed Smooth Scroll to Top Link

Make scroll to top link becomes sticky.

PHP in CSS and JavaScript Files

Using HTACCESS to parse PHP syntax in CSS and JavaScript files.

Authors Field

Handle single page with multiple authors.

Custom Log In Redirection

Redirect user to custom destination after logged in.

State Hooks

Force some values to the default states values.

Detect External Links

External links checker for “HTML” page type.

Automatic Debug Mode

Activate debug mode if offline, deactivate if online.

Addon Domain Redirection

Redirect from base domain to alternate domain with PHP.

Poll Notification

Send email notification on every user interaction to the poll widget.

Automatic Keyword Links

Automatically generate list of keyword links based on the current page slug.

Asset Block

Maintainable asset URL in page content.

Mark Site Author’s Comments

Set a unique style to the site author’s comments.

Automatic Date Format

Automatically set date format based on user language.

Main Text Editor API

Accessing the main text editor’s text selection range API.

Next and Previous Pagination Links with the Post Title

How to add post title to the next and previous link of the item page.

Estimated Reading Time

Gives the information needed to make a quick decision on whether to commit to reading an article or not.

Manual Post Excerpt

Add manual post excerpt feature.

Custom Comment Avatar Image

Replace the default comment’s Gravatar image with your own comment avatar image.

Dynamic Site Description/Slogan

Automatically change the site slogan based on the current page description.

Basic Related Posts

Show list of pages in random order, filtered by the similarities of the current page file name.

Automatic Custom Posts

Change page color theme automatically based on the current URL path.

Grab User’s Comment IP and UA

Store user’s IP and user’s UA string on every comment creation event.

Basic Recent Comments

Show list of comments in reverse order by time.

Emoji in Comment Form

Add minimalist native emoji insertion helper in the comment form.

Block Users by IP Address

Block users and visitors by their IP addresses.

Custom Math Captcha

Playing around with the math captcha.

Store User Comment Data in the Comment Form

Using session to store your visitor’s comment data in the comment form.

Disable Comments

Disable comments on specific page.

Disable Comments on Static Pages

Disable comments on pages that are relative to the root URL.

Automatic Image Width & Height Attribute

Applies only for local images.

Images Field

Extract images URL from page content.

Basic Things

Common usage of the API.

Add Log In/Out Link

Show log in/out link.

Search Form

Basic search form.

Basic Page Tags

List all tags from the current page.

Basic Recent Posts

Show list of pages in reverse order by time.

Basic Tags Widget

List all of the available tags from the current page folder.

Basic Random Posts

Show list of pages in random order.

Basic Popular Posts

Show list of most viewed pages.

Automatic Paragraph

Wrap description data with paragraph tags if it doesn’t have paragraph tags.

Static Time Field

Automatically generate static time data on the first page visit, so that updating the page files will not change its publication time.