Code Monkey home page Code Monkey logo

fulcrum's Introduction

Fulcrum

Build Status Latest Stable Version License

Fulcrum - The customization central repository to extend and custom WordPress. This plugin provides the centralized infrastructure for the custom plugins and theme.

The Why of Customization Central

This plugin provides a central location for all redundant functionality. It keeps your plugins and theme DRY, reusable, and modular. It is meant to be extended. Therefore, when you need a feature-specific plugin like a Portfolio, Testimonials, or FAQ, you extend the Fulcrum\Addon\Addon class in your plugin. Then you configure what service providers you need.

Did you read that last part? It's configuration over code, meaning you configure what you want! (Did you get a tingle?)

Bottom Line: It saves you a ton of time and code in your plugins, which saves you moola.

Features

This plugin is fully crafted in OOP. It utilizes DI Container, Dependency Injection, Polymorphism, Inheritance, etc. It shows you how to build OOP-capable plugins.

It also uses:

  • Composer and its autoload functionality in place of filling a function with includes and requires.
  • Gulp as it's task runner
  • Config files, which abstract the runtime configuration out of the modules and into fulcrum/config folder where they belong.
  • Service Providers for the Addons to utilize, which simply the need-to-know in the addons. Configure and fire them up.

Includes:

  • Pimple - as the DI Container
  • Shortcodes
  • Meta boxes
  • Custom Post Types
  • Custom Taxonomy
  • Widgets

Some Cool Packages

Fulcrum includes some cool packages to make your job more fun.

  • Kint - a modern and powerful PHP debugging helper
  • Whoops - PHP Errors for Cook Kids
  • Carbon - A simple PHP API extension for DateTime.
  • Pimple - as the DI Container

Installation

Installation from GitHub is as simple as cloning the repo onto your local machine. Typically, I put Fulcrum as a must use plugin. Why? Because the child theme and all custom plugins extend off of it. Therefore, you want it to always be activated.

To install it as a must use, here's what you want to do:

  1. Open your project and navigate to wp-content/mu-plugins.
  2. Then open terminal (or console).
  3. Then type: git clone https://github.com/hellfromtonya/Fulcrum.git fulcrum.
  4. Change the directory by typing: cd fulcrum.
  5. Next, run Composer to install all of the assets. Type composer install at the root of the Fulcrum folder.
  6. Next, add an auto-launcher to load Fulcrum. If one exists already, then add require __DIR__ . '/fulcrum/bootstrap.php'; into it. Otherwise, do the following:
    • Navigate to fulcrum/mu-loader/ and copy the mu-autoloader.php file.
    • Paste it into the root of wp-content/mu-plugins.
    • Bam, Fulcrum now loads itself up without you or your client needing to activate it. WooHoo!

Contributing

All feedback, bug reports, and pull requests are welcome.

fulcrum's People

Contributors

hellofromtonya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

fulcrum's Issues

Shortcode Always True in Widgets

When placing a shortcode within a text widget, it always executed regardless of whether or not the configuration is set to false:

Shortcode.php

public function renderCallback($attributes, $content = null)
{
    if (is_admin()) {
        return null;
    }

    $this->attributes = shortcode_atts($this->config->defaults, $attributes, $this->config->shortcode);
    $this->content    = $this->config->doShortcodeWithinContent === true
        ? do_shortcode($content)
        : $content;

    return $this->render();
}

Custom Shortcode

return [
'autoload' => true,
'classname' => '',
'config'   => [
    'shortcode'        => 'section',
    'defaults'         => [
        'link'         => '#',
        'thumbnail'    => '#',
        'header_tag'   => 'h3',
        'title'        => '',
        'button_title' => 'Access Now',
    ],
    'doShortcodeWithinContent' => false,
    'view'                     => $rootPath . 'src/Shortcode/views/section.php',
],
];

SidebarRegister.php

protected function initEvents()
{
    add_action('init', [$this, 'run'], 20);
    //add_filter('widget_text', 'do_shortcode');
}

Is this behavior expected since WP 4.9?

https://make.wordpress.org/core/2017/10/24/widget-improvements-in-wordpress-4-9/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.