Coder Social home page Coder Social logo

wpexpress's Introduction

WPExpress - A WordPress Framework for Software Developers

For all of you my fellow developers who are not familiar with WordPress.

Instead of trying to sell you into WordPress I'll ask you to do a google search for why wordpress.

Then do the same for other Content Management Systems, read a little, then decide what's better for you.

I will however tell you why I use WordPress to run my Websites.

WordPress powers +25% of the websites on the Internet. This means that 1 of every 4 websites are using it.

Some of the bennefits it gives me:

  • Improved time to market
  • Easily create Content Networks
  • Thousands of themes free and premium
  • Thousands of plugins free and premium
  • It is already a great blogging platform
  • Great UX
  • BuiltIn API
  • Runs on apache or nginx
  • It runs 1/4 of the Internet's websites
  • And it is Open Source

What is WPExpress

I like using frameworks like Rails, Laravel and Symfony.

They make me love writing code.

Very smart people wrote hundreds of thousands of lines of code to implement concepts such as Separation of Concern, Convention over Configuration and so on.

I love rake, and artisan. I am infatuated with how Symfony is structured as a set of components rather than a full fledged Framework.

And I also have a thing for composer, autoloading and depedency management.

Last but not least. I worship Mustache and Twig

When you get to know and work in environments as cool as those I have talked about, going back to monolite-style code writing is, HARD.

I found myself having to write similar code across different projects and I decided I wanted to focus on writing meaningful code and abstract the repetitive stuff as much as possible.

I wanted to go from this

$args = array();

$query = new WP_Query( $args );

wp_reset_post_data();

To this

$posts = Query::Posts->limit(10)->meta('field', 'value')->get();

I wanted to use composer, abstraction and chainable methods, and every other thing I love in modern PHP within WordPress. But here's the compromise. I do not want to change WordPress.

I do not want to write my own queries, I do not want to alter the core. I want WordPress to be kept intact. I just want a Framework which will allow me to do more with less.

Less configuration, less plugins, less time to market.

Finally I am writing this framework to allo my self to focus on writing meaningful code.

Quick Start

This small WordPress Frmework is designed to be easy to use.

Start by reading our documentation.

Framework Structure

wpexpress's People

Contributors

page-carbajal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

wpexpress's Issues

SettingsPage feature is broken

When trying to create a new settings page the feature should not require the user to create a template. It should use the default included with the project.

add_rewrite_tag() on a non-object

This issue presents itself with this code

namespace MyNamespace\Model;


use WPExpress\Model\BaseModel;


class MyType extends BaseModel
{
    public function __construct( $bean = null )
    {
        $this->setPostTypeLabels(array(
            'name'          => __('My Types', 'tn_affillate_links'),
            'singular_name' => __('My Type', 'tn_affillate_links'),
        ));

        $this->setSupportedFeatures(true, true, true);

        $this->setPublic(false);

        parent::__construct($bean);

        $this->add_custom_fields();
    }

    private function add_custom_fields()
    {
        $this->fields->addTextInput('shortcode')->addLabel(__('Short Code', 'tn_affillate_links'));
        return $this;
    }

}

Post and Page classes are outdated

This classes included with the repo are outdated.

<?php


namespace WPExpress;


use WPExpress\Model\BaseModel;
use WPExpress\Model\BaseModelInterface;


final class Page extends BaseModel implements BaseModelInterface
{

    public function __construct( $bean )
    {

        $this->nameLabel           = 'Pages';
        $this->singularNameLabel   = 'Page';
        $this->postTypeDescription = 'Write your description here';
        $this->postTypeSlug        = 'page';

        $this->setSupportedFeatures(true, true, true);

        parent::__construct($bean);
    }

    /**
     * Override this function on your theme to set your Custom Post Type
     *
     * @return string. The custom post type.
     */
    public static function getPostType()
    {
        if( !isset( self::$postType ) ) {
            static::$postType = 'page';
        }
        return static::$postType;
    }

}

BaseModel renderFields outdated

The renderFields Functionality is outdated. It implies The use of mustache. Refactor to use PHP

    public function renderFields( $post, $params )
    {
        $me = new static($post);

        // Auto Load Field Values
        $me->loadFieldValues();

        $templatePath = empty( $me->templatePath ) ? untrailingslashit(dirname(__FILE__)) . "/../../resources/templates" : $me->templatePath;
        $engine       = new RenderEngine($templatePath);
        $boxID        = $params['args']['currentMetaBox'];
        $fields       = $me->fields->parseFields($me->metaBoxes->box($boxID)->getFields());

        echo $engine->renderTemplate('metabox-content', $this->getMetaBoxContext($me, $fields));
    }

On settingsPage.class.php a line is missing.

addMyFields() ->setPageDescription($description) ->setPageTitle(__('Email Tool', 'mytextdomain')) ->registerPage('options'); } public function addMyFields() { $atts = array( 'style' => 'min-width: 400px;', 'readonly' => false ); $this->registerMetaField( 'idNumber', __( 'ID Number', 'mytextdomain' ), 'text', '', $atts ); $this->registerMetaField( 'title', __( 'Title', 'mytextdomain' ), 'text', '', $atts ); } ``` ###### # return $this; } // On your Setup File //// Register the Page $options = new MyOptions(); //// Retrieve option values $options->getValue('title');

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.