twitter
    Find out what I'm doing, Follow Me :)
If you have any question, suggestion or article topic for me to write, feel free to contact me through my shout box. ;) Some time I need an idea to write. hehe Hopefully I can help you and share my expertise.

customize wordpress installation

How to custom install wordpress?. I'm currently work with wordpress custom installation. My objective is to make wordpress automatically install and activate plugin when I install new wordpress file. If you asking it is possible?. My answer is YES.. it is.

How to create custom wordpress installation?


1. If you install wordpress file, by default wordpress will execute install.php under wp-admin/install.php and then execute upgrade.php under wp-admin/includes/upgrade.php
2. open upgrade.php file and you can see at line 11.
/** Include user install customize script. */
if ( file_exists(WP_CONTENT_DIR . '/install.php') )
require (WP_CONTENT_DIR . '/install.php');

the script will check whether there is install.php file in the wp-content/ . If have, it will execute this script first.
3. to use custom script, you need to create install.php file in the wp-content/install.php
4. you may create wp_install() function inside wp-content/install.php to override n wp_install() at wp-admin/includes/upgrade.php . you can add whatever you want like automatically install/activate plugin, change default theme etc here without make any changes at original upgrade.php code.

what does & ( ampersand ) simbol infront of variable means in php

Prior to PHP5, when you created an object from a class in PHP, that object would be passed into other variables by value. The object was NOT a reference, as is standard in most other object oriented (Java, C#, etc.) languages.

However, by instantiating a class with an ampersand in front of it, you could create a reference to the returned object, and it would behave like an object in other languages. This was a common technique prior to PHP5 to achieve OOP like effects and/or improve performance.

eg
$foo = 'bar';
$baz = &$foo;

echo $foo //bar
echo $baz //bar

$foo = 'foobazbar';
echo $foo //foobazbar
echo $baz //foobazbar



ref
http://www.php.net/manual/en/language.references.whatdo.php
http://us3.php.net/manual/en/language.references.pass.php