This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Helper Functions | |
/** | |
* Programmatically creates a WordPress post based on the incoming parameters. | |
* | |
* Note: This function may need some additional work if you're dealing with non-English languages. | |
* | |
* @param string $title The title of the page as presented to the users | |
* @param string $slug The slug used to access the page via the URL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function add_admin_menu_separator($position) { | |
global $menu; | |
$index = 0; | |
foreach($menu as $offset => $section) { | |
if (substr($section[2],0,9)=='separator') | |
$index++; | |
if ($offset>=$position) { | |
$menu[$position] = array('','read',"separator{$index}",'','wp-menu-separator'); | |
break; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'admin_init', 'add_sep' ); | |
function add_sep() { | |
if ( ! is_admin() ) | |
return false; | |
global $menu; | |
$sep = $menu[4]; // that's the default separator | |
$pos = 6; // change it for the desired position | |
$menu = array_merge( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function move_to_top(&$array, $key) { | |
$temp = array($key => $array[$key]); | |
unset($array[$key]); | |
$array = $temp + $array; | |
} | |
function move_to_bottom(&$array, $key) { | |
$value = $array[$key]; | |
unset($array[$key]); | |
$array[$key] = $value; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo 'Current PHP version: ' . phpversion(); | |
echo phpversion('tidy'); // if the extension isn't enabled |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hdiutil makehybrid -o ~/Desktop/image.iso ~/path/to/folder/to/be/converted -iso -joliet |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl'; | |
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl'); | |
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl'); | |
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Text_Editor_Custom_Control extends WP_Customize_Control | |
{ | |
public $type = 'textarea'; | |
/** | |
** Render the content on the theme customizer page | |
*/ | |
public function render_content() { ?> | |
<label> | |
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> | |
<?php |
OlderNewer