Skip to content

sourcescript/wordpress-factory

Repository files navigation

Wordpress Factory By SourceScript

A Well Placed Elegant Wordpress Factory Generated to you by SourceScript Innovations. The Wordpress Factory is a boilerplate plugin that would allow the developer to use 3rd party classes easily. Not only that you could use 3rd party classes easily, The developer now can autoload's his/her own classes from other frameworks easily. No more procedural development on wordpress plugins, and no more hard-coding development on wordpress plugins.

This plugin is <> with <3 for the Open Source Community. SourceScript Innovations #Installation You are required first and foremost to download The Composer. After you have downloaded and installed this plugin. all you have to do is run 'php composer.phar install --prefer-dist' You will be then given one beautiful placed folder app this folder has two folders inside, the functions and the views the functions component will harbor all of your autoloaded class files (with / without) namespaces. While the views folder (you guessed it right) harbors all the template files generated by Twig. Yes, Awesome isn't it! We use twig! on Wordpress! ##Configurations All configuration shall be manifested under app.php. ###Configuring the Options Page Is it hard to create your own options page WITH elegance on wordpress? Now its autoloaded for you, all you have to do is open and edit app.php it houses a 'options'. These would hold the 4 required files.

If editing the files are too much of a burden, you open the functions/OptionsPage.php and edit it yourself. The Views component is autoloaded already under views/options/options.html.twig.

#Calling The Views Component We Have graciously wrapped Twig for you. all you have to do is

	echo View::factorize('options/options.html.twig')->load();

You may add parameters

	echo View::factorize('options/options.html.twig')->load(['title'=>'Options Title', 'content'=>'content']);

#Asset Loading Getting tedious and irritated with having to load alot of wp_enqueue_stlye or wp_enqueue_scripts? Now you don't have to all you have to do is load

Asset::factorize('back','styles')->queue();  // for back end scripts 
//and
Asset::factorize('back','scripts')->queue(); // for back end styles

You are required two parameters loc and type consecutively, each will load separate config files depending on what you need. the following examples shall load config\back_styles_assets.php`` and config\back-scripts_assets.php```

the format you are required to have is __assets.php #Adding more packages You may add your own packages with the use of composer. After downloading the composer file you may easily autoload it with app.php just add your folder like so.

	'libs'	=> array(
			'MyLib' 		=> base_path().'/../vendor/sourcescript/wf-core-framework/src', //add your own file
		),

#Made With Love Using -Symfony -Twig