Fills the brand new blog with starting data

author etessore
version 1.0.0
package classes

 Methods

Adds all automatically generated pages to the given menu

add_menu_entries(int $menu_id, int $start, int $end) : \NewBlogInitializator

Parameters

$menu_id

int

the menu id

$start

int

the first element index

$end

int

the last element index

Returns

\NewBlogInitializator$this for chainability

Adds an automatically generated page to the given menu

add_menu_entry(int $index, int $menu_id) : \NewBlogInitializator

Parameters

$index

int

the index of $this->pages array

$menu_id

int

the menu id

Returns

\NewBlogInitializator$this for chainability

Inserts a new page into WP

add_page(string | array $parms) : int

Parameters

$parms

stringarray

page details according to {@link http://codex.wordpress.org/Function_Reference/wp_insert_post wp_insert_post()}

Returns

intthe post id

Creates the basic structure for a child theme.

add_theme(array $parms) : \NewBlogInitializator

This method tries to make a new theme directory under the wp-contents/themes. Then tries to create style.css in the newly theme folder and fill it with the default header comment

An example of parameters:

$defaults = array(
        'name'          =>  'Wordpress Theme Utils Child Theme',
        'folder'        =>  'wtu-child-theme',
        'child_of'      =>  'Wordpress-Theme-Utils',
        'description'   =>  'This is a Child Theme of Wordpress Theme Utils',
        'theme_uri'     =>  'http://www.emanueletessore.com/',
        'author'        =>  'Emanuele Tessore',
        'author_uri'    =>  'http://www.emanueletessore.com/',
        'version'       =>  '1.0.0'
);

Uses wp_die() if something goes wrong

Parameters

$parms

array

parameters for the new theme

Returns

\NewBlogInitializator$this for chainability

Creates the menu with given name

create_menu(string $name, string $location) : \Ambigous

If a menu with given name exists this method will return its id. If $location parameter is passed this method will assign the menu with given $name to such location

Parameters

$name

string

the menu name

$location

string

Returns

\Ambigous >

Deletes all pages

delete_all_pages() : \NewBlogInitializator

WARNING: it does NOT ask if you're sure!!!

Returns

\NewBlogInitializator$this for chainability

Removes the default 'Hello World' post and page

delete_default_posts() : \NewBlogInitializator

Returns

\NewBlogInitializator$this for chainability

Enables the new theme for the current blog

enable_theme() : \NewBlogInitializator

Returns

\NewBlogInitializator$this for chainability

Gets the automatically generated page details

get_page_details(int $index) : array

Parameters

$index

int

the id of the page

Returns

arraylist of details, false if the $index doesn't point to an automatically generated page

Hooks the initial data filling into WordPress

hook() 

Initializes the blog with starting data.

init(int $blog_id) 

Overload this in a child ob ject if you need customization on starting data

Parameters

$blog_id

int

the blog id

Resets the list of the automatically generated pages

reset_page_list() : \NewBlogInitializator

Returns

\NewBlogInitializator$this for chainability

In a MultiSite environment selects the right blog

select_blog() : \NewBlogInitializator

Returns

\NewBlogInitializator$this for chainability

 Properties

 

$blog_id : int
 

$pages : array
 

$theme : array