Skip to content

Adding WordPress Plugin Documentation #357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 5.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -246,3 +246,14 @@ There are different types of documentation available to help you navigate your w

users_roles/managing_users
users_roles/managing_roles

.. toctree::
:maxdepth: 2
:caption: WordPress Plugin
:hidden:

wordpress/installation
wordpress/shortcodes
wordpress/tracking
wordpress/settings
wordpress/developers
10 changes: 10 additions & 0 deletions docs/wordpress/developers.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Developers
==========

This section covers everything you need to know about setting up your environment and integrating with WordPress.

.. toctree::
:maxdepth: 2

environment
hooks-and-functions
49 changes: 49 additions & 0 deletions docs/wordpress/environment.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Environment
===============

Before you begin developing, ensure you have **Docker** running on your system.

Getting Started
---------------

First, clone the WordPress development repository:

::

git clone https://github.com/WordPress/wordpress-develop.git

Change into the cloned directory:

::

cd wordpress-develop

Initial Setup
---------------

Run the following commands to set up your environment:

::

npm install
npm run build:dev
npm run env:start
npm run env:install

These commands will:

- Install all Node.js dependencies.
- Build development versions of WordPress assets.
- Start the local Docker containers for WordPress.
- Install WordPress into the Docker environment.

Useful Commands
---------------

After setup, you can use these commands to control your environment:

- ``npm run env:start`` — Start Docker containers.
- ``npm run env:stop`` — Stop Docker containers.
- ``npm run env:restart`` — Restart Docker containers.

Visit your local WordPress install at **http://localhost:8889**.
23 changes: 23 additions & 0 deletions docs/wordpress/hooks-and-functions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Hooks & Functions
===============

Useful Functions
---------------

- ``wpmautic_option( $option, $default )`` — Retrieve plugin settings safely.
- ``wpmautic_base_script()`` — Get full URL of ``mtc.js`` script.
- ``wpmautic_get_tracking_attributes()`` — Get custom tracking data array.

Filters
---------------

Extend the plugin using:

::

apply_filters('wpmautic_tracking_attributes', $attrs)

Actions
---------------

- ``wp_head`` or ``wp_footer`` — Automatically injects Mautic script depending on settings.
16 changes: 16 additions & 0 deletions docs/wordpress/installation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Installation & Activation
=========================

Requirements
------------

- WordPress 4.6 or later
- PHP 5.6 or later

Steps
-----

1. Download the WP Mautic plugin.
2. Go to your WordPress Admin Dashboard → Plugins → Add New.
3. Click "Upload Plugin" and choose the downloaded ZIP file.
4. Click "Install Now" and then "Activate".
15 changes: 15 additions & 0 deletions docs/wordpress/settings.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Plugin Settings
===============

Accessing the Settings
-----------------------

Navigate to **Settings → WPMautic** from your WordPress dashboard.

Available Options
-----------------

- **Base URL:** The URL where your Mautic instance is installed (e.g., ``https://your-mautic.com``).
- **Script Location:** Choose whether to inject tracking code in the header, footer, or disable it.
- **Track Logged In Users:** Enable tracking details like email, username for logged-in users.
- **Fallback Activation:** Adds a ``<noscript>`` image tracking fallback if JavaScript is disabled.
20 changes: 20 additions & 0 deletions docs/wordpress/shortcodes.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Shortcodes & Usage
==================

Available Shortcodes
---------------------

WP Mautic currently provides a shortcode API through ``shortcodes.php``.

Example Usage
~~~~~~~~~~~~~

::

[mautic type="form" id="1"]

Parameters
----------

- **type:** Type of Mautic asset (``form``, etc.).
- **id:** The ID of the Mautic form or asset you want to embed.
17 changes: 17 additions & 0 deletions docs/wordpress/tracking.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Tracking Script Behavior
=========================

Header vs Footer
----------------

You can choose to load the Mautic tracking script in the site header (faster pageview tracking) or footer (better performance).

Fallback Tracking
------------------

If a visitor has JavaScript disabled, a fallback ``<img>`` tag is automatically added for tracking via a tracking pixel.

Custom Attributes
------------------

The plugin automatically sends additional metadata like language, page title, referrer, and user details if enabled.