2017 © Pedro Peláez
 

yii2-extension yii2-module-wordpress

wordpress CMS for Yii2 Framework

image

amintado/yii2-module-wordpress

wordpress CMS for Yii2 Framework

  • Tuesday, September 26, 2017
  • by amintado
  • Repository
  • 3 Watchers
  • 0 Stars
  • 28 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 3 Open issues
  • 2 Versions
  • 12 % Grown

The README.md

this module is a customized WordPress module for yii2, (*1)

Installed WordPress

untitled, (*2)

install

$ composer require amintado/yii2-module-wordpress "*"

OR add this line to composer.json, (*3)

"amintado/yii2-module-wordpress":"*"

Config

add, (*4)

'cms'=>[
            'class'=> amintado\wordpress\Module::className(),
        ]

to frontend/config/main.php file, under modules array, for example:, (*5)

'modules' => [
        'cms'=>[
                    'class'=> amintado\wordpress\Module::className(),
                ]
]

create a php file with this name in root project directory: status.php add this lines to status.php:, (*6)

defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
defined('WP_USE_THEMES') or define('WP_USE_THEMES', true);

now delete this lines from your Yii2 app index file to prevent conflict:, (*7)

defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');

and require(status.php) in your app index.php file, (*8)

Now Install Wordpress

open this link: http://yourhost.com/frontend/index.php/cms, (*9)

then module will create a folder with 'cms' name in your root project directory, and will install WordPress there., (*10)

wordpress tables will create automatic in your DB if you are using mysql by default., (*11)

after install system will redirect webpage to installed wordpress directory., (*12)

Parameters

after wp installed,you can login to wp with this config:, (*13)

admin username:wpadmin, (*14)

admin password: 123456789, (*15)

Change Parameters

you can also change default parameters before install WordPress on Your project, just config this parameters in config array in config/main.php file:, (*16)

'modules' => [
        'cms'=>[
                    'class'=> amintado\wordpress\Module::className(),
                    'WeblogTitle'=>'amintado Yii2 WordPress Module',
                    'WeblogUsername'=>'wpadmin',
                    'WeblogEmail'=>'amintado@gmail.com',
                    'WeblogPassword'=>'123456789',
                    'WeblogPublic'=>1
                ]
]

Notic

wordpress admin options and menu will disable in debug mode, for example if YII_DEBUG=true then all wordpress admin menus and admin bars will disable., (*17)

this settings can set or unset in function.php file in theme folder., (*18)

if you have solution for that, tell me your solution., (*19)

License

This Module is Under GPL3 LICENSE, (*20)

Improve

if you want work with WP on YII2 Framework realy, this module is first created,then help to Improve it :), (*21)

For Persian Programmers

this WordPress is contain translated and RTL wp layers slider plugin. that you can use it in your Project, (*22)

use WP functions in Yii2

if you want use WP functions in yii for example load a post or load an slide in your Yii2 project You must require wp-load.php file to your project., (*23)

Attention

Never Use wp-load.php in index.php file. use it in nedded controllers or actions only., (*24)

if you require wp-load.php file in your index.php file or any certain part of project, your CSRF validation in login,logout and every form in your site will conflict with wordpress,and your posted data will filter and will change to null., (*25)

use YII2 functions in installed WordPress

wp-load.php file is contain Yii2 starter php files., (*26)

you can see added codes here:, (*27)

require (__DIR__.'/../status.php');

if (strpos(parse_url($_SERVER  ["REQUEST_URI"])['path'],'cms',0)){

require(__DIR__ . '/../vendor/autoload.php');
require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');
require(__DIR__ . '/../common/config/bootstrap.php');
require(__DIR__ . '/../backend/config/bootstrap.php');
//require(__DIR__ . '/../cms/wp-load.php');

$config = yii\helpers\ArrayHelper::merge(
    require(__DIR__ . '/../common/config/main.php'),
    require(__DIR__ . '/../common/config/main-local.php'),
    require(__DIR__ . '/../backend/config/main.php'),
    require(__DIR__ . '/../backend/config/main-local.php')
);

(new yii\web\Application($config));

}

WordPress Version

the based wordpress that used in this module:, (*28)

version:4.8.1 with persian full translated package, (*29)

The Versions

26/09 2017

dev-master

9999999-dev https://github.com/amintado/yii2-module-wordpress

wordpress CMS for Yii2 Framework

  Sources   Download

GPL

The Requires

  • php >=5.6.0

 

by Avatar amintado

yii2 amintado yii2-wordpress yii2 wordpress module

26/09 2017

v0.1.x-dev

0.1.9999999.9999999-dev https://github.com/amintado/yii2-module-wordpress

wordpress CMS for Yii2 Framework

  Sources   Download

GPL

The Requires

  • php >=5.6.0

 

by Avatar amintado

yii2 amintado yii2-wordpress yii2 wordpress module