http://stackoverflow.com/questions/4671378/levenshtein-mysql-php
Friday, 4 April 2014
Friday, 31 January 2014
How to make Wordpress root-relative
Add the following lines to your wp-config file (found in the root).
define('WP_HOME',"http://" . $_SERVER['HTTP_HOST']);
define('WP_SITEURL',"http://" . $_SERVER['HTTP_HOST']);
define( 'WP_CONTENT_DIR', dirname( __FILE__ ) . '/wp-content' );
define( 'WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/wp-content' );
// added by chetan Custom plugin directory
define( 'WP_PLUGIN_DIR', dirname( __FILE__ ) . '/wp-content/plugins' );
define( 'WP_PLUGIN_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/wp-content/plugins' );
Then prevent the functions get_site_url() and get_home_url from accessing the wp_options database table to get the server domain or ip.
For this edit the link-template.php file:
Find the function get_home_url and comment every occurrence of this line like so:
// $url = get_option( 'home' );
and add this:
$url = "http://" . $_SERVER['HTTP_HOST'];
Do the same for get_site_url():
// $url = get_option( 'siteurl' );
and add this:
$url = "http://" . $_SERVER['HTTP_HOST'];
Now, to make sure any media files that are uploaded use root relative urls, install the following plugin:
http://wordpress.org/plugins/root-relative-urls/
define('WP_HOME',"http://" . $_SERVER['HTTP_HOST']);
define('WP_SITEURL',"http://" . $_SERVER['HTTP_HOST']);
define( 'WP_CONTENT_DIR', dirname( __FILE__ ) . '/wp-content' );
define( 'WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/wp-content' );
// added by chetan Custom plugin directory
define( 'WP_PLUGIN_DIR', dirname( __FILE__ ) . '/wp-content/plugins' );
define( 'WP_PLUGIN_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/wp-content/plugins' );
Then prevent the functions get_site_url() and get_home_url from accessing the wp_options database table to get the server domain or ip.
For this edit the link-template.php file:
Find the function get_home_url and comment every occurrence of this line like so:
// $url = get_option( 'home' );
and add this:
$url = "http://" . $_SERVER['HTTP_HOST'];
Do the same for get_site_url():
// $url = get_option( 'siteurl' );
and add this:
$url = "http://" . $_SERVER['HTTP_HOST'];
Now, to make sure any media files that are uploaded use root relative urls, install the following plugin:
http://wordpress.org/plugins/root-relative-urls/
Monday, 27 January 2014
VirtualBox Disable Time Sync
vboxmanage setextradata [VMname] "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" "1"
Turn it back on:
vboxmanage setextradata [VMname] "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" "0"
Turn it back on:
vboxmanage setextradata [VMname] "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" "0"
Tuesday, 10 December 2013
Buddypress show date and time of post instead of elapsed days and hours
In the themes functions.php add this (the 19800 is 5:30 hours in seconds for IST) :
function format_activity_date()
{
$activityDate=bp_get_activity_date_recorded();
return date("M j, Y G:i", strtotime($activityDate)+19800);
}
add_filter('bp_activity_time_since', 'format_activity_date');
Note: This does not affect comments
function format_activity_date()
{
$activityDate=bp_get_activity_date_recorded();
return date("M j, Y G:i", strtotime($activityDate)+19800);
}
add_filter('bp_activity_time_since', 'format_activity_date');
Note: This does not affect comments
Friday, 6 December 2013
Wordpress - Create a plugin to override a pluggable function
http://sltaylor.co.uk/blog/customizing-new-user-email-pluggable-function/
http://codex.wordpress.org/Pluggable_Functions
http://codex.wordpress.org/Pluggable_Functions
Thursday, 5 December 2013
Change the version of a wordpress javascript file
Search for wp_enqueue_script and change the version number in the argument.
http://codex.wordpress.org/Function_Reference/wp_enqueue_script
http://codex.wordpress.org/Function_Reference/wp_enqueue_script
Using at and crontab
http://www.cyberciti.biz/tips/howto-shutdown-linux-box-automatically.html
Subscribe to:
Posts (Atom)