Skip to main content
  1. All Posts/

wordpress-plugin-construction

Tools PHP

WordPress plugin construction

Tools for developing and running a awesome WordPress website.
Please select a folder in the list above to see the plugin’s development.

Two programmers

https://en.wikipedia.org/wiki/Pair_programming

An article about code quality

http://engineering.quora.com/Moving-Fast-With-High-Code-Quality

Plugin headers

readme.txt https://developer.wordpress.org/plugins/wordpress-org/how-your-readme-txt-works/

=== Plugin Name ===
Contributors: (comma, separated, list of wordpress.org userid's)
Donate link: https://example.com/
Tags: comments, spam
Requires at least: 4.9
Tested up to: 5.2.2
Requires PHP: 7.0
Stable tag: 1.0.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Here is a short description of the plugin. This should be no more than 150 characters. No markup here.

https://developer.wordpress.org/plugins/plugin-basics/header-requirements/ @wordpress-plugin

/**
 * Plugin Name
 *
 * @package     PluginPackage
 * @author      Your Name
 * @copyright   2019 Your Name or Company Name
 * @license     GPL-2.0-or-later
 *
 * @wordpress-plugin
 * Plugin Name: Plugin Name
 * Plugin URI:  https://example.com/plugin-name
 * Description: Description of the plugin.
 * Version:     1.0.0
 * Author:      Your Name
 * Author URI:  https://example.com
 * Text Domain: plugin-slug
 * License:     GPL v2 or later
 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
 */

How to add images to a WordPress plugin?

One-class file comment

<?php
/**
 * Administration API: WP_Internal_Pointers class
 *
 * @package WordPress
 * @since 4.4.0
 */

/**
 * Core class used to implement an internal admin pointers API.
 *
 * @since 3.3.0
 */
final class WP_Internal_Pointers {

Recommended plugins

Data structure plugin categories

  • CPT (Custom port type)
  • Custom taxonomy
  • Custom post meta
  • Custom taxonomy meta
  • Custom user meta
  • Plugin option page
  • Theme options page
  • Shortcodes
  • Widgets
  • Widget display conditions widget-context
  • Search custom contents

Various content plugin categories

  1. Content Forcing
    • force-featured-image
    • mu-deny-giant-image-uploads/
  2. Content Fixes
    • mu-shortcode-unautop/
    • custom-post-type-permalinks
  3. UI tuning / Bulk edit aid
    • Editor: tinymce-advanced
    • Lenghten taxonomy selector boxes, see: content-extras/nav-menu-meta-box-length.php https://core.trac.wordpress.org/ticket/32237
    • Keep category tree in post editor Category Checklist Tree category-checklist-tree
    • mu-cleanup-admin/
    • wp-solarized
    • mark-posts
    • https://github.com/fusioneng/Unified-Post-Types
    <pre>add_filter( 'unified_post_types', function ( $post_types ) {
    $post_types[] = 'portfolio';
    $post_types[] = 'news';
    return $post_types;
    

    });

    <ul dir="auto">
      <li>
        <code>simple-page-ordering</code>
      </li>
      <li>
        <code>post-types-order</code>
      </li>
      <li>
        Media URL column, see: content-extras/media-url-column.php
      </li>
      <li>
        <code>codepress-admin-columns</code>
      </li>
      <li>
        <code>featured-image-column</code>
      </li>
      <li>
        <code>advanced-excerpt</code>
      </li>
      <li>
        Advanced Image Styles <code>advanced-image-styles</code>
      </li>
      <li>
        <code>unattach</code>
      </li>
    </ul>
    
  4. Content representation
    • Pods
    • https://github.com/alleyinteractive/wordpress-fieldmanager
    • CMB2
    • https://github.com/jtsternberg/Shortcode_Button with CMB2
    • shortcode-ui
    • custom-content-shortcode
    • column-shortcodes
    • tablepress
    • Map wp-geo
    • ankyler widget
  5. Imaging
    • Cloudinary
    • my-eyes-are-up-here
  6. Tracking
    • google-universal-analytics/
    • .
  7. CDN
    • https://github.com/markjaquith/WP-Stack/blob/master/WordPress-Dropins/wp-stack-cdn.php
    • .

Manage WordPress installation with git

  1. Core as submodule at /company/ with URL https://github.com/WordPress/WordPress.git
  2. Theme as submodule with URL file:///home/user/website/theme.git
  3. WP.org plugins are gitignore-d.
  4. Non-WP.org plugins as submodules with URL file:///home/user/website/plugin.git

Manage WordPress plugins with composer

http://wpackagist.org/

WordPress .gitignore

See https://github.com/szepeviktor/debian-server-tools/blob/master/webserver/wordpress.gitignore