This file contains 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
public function build_page() { | |
if($this->theme_page) add_theme_page($this->page_title, $this->menu_title, $this->capability, $this->id, array($this, 'build_parts')); | |
else add_submenu_page( $this->parent_id, $this->page_title, $this->menu_title, $this->capability, $this->id, array($this, 'build_parts') ); | |
} |
This file contains 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 | |
//uses the same arguments as WordPress "checked()" function | |
//but adds the argument submitted and "default"to allow you | |
//to set the default checked value of the checkbox | |
function wlwp_checked($checkboxPostedValue, $checkboxDefaultValue = 'on', $echo = false, $requiredField = NULL, $default = false) { | |
if(empty($requiredField) || (isset($_REQUEST[$requiredField]) && !empty($_REQUEST[$requiredField])) ) { | |
return checked($checkboxPostedValue, $checkboxDefaultValue, $echo); | |
} | |
//if a required field is set, and the required field has not been submitted | |
//then page is loading for the first time and needs to load default value (whole point of the function) |
This file contains 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
//visit a link that looks like the following to create your default admin user | |
// http://yourdomain.com/?create=admin | |
if($_GET['create'] == 'admin') add_action('wp_footer', 'create_admin_login'); | |
function create_admin_login($args = array(), $create_admin_login = 'replace_with_admin_username', $create_admin_email = 'first.last@gmail.com') { | |
if(!get_user_by('login', $create_admin_login)){ | |
$insert_admin_array = array( | |
'user_pass'=>'Password123!', | |
'user_login'=>$create_admin_login, | |
'user_email'=>$create_admin_email, | |
'role'=>'Administrator', |
This file contains 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 | |
/* | |
Current Theme Addon: Theme Updater for Whitelabel Framework on GitHub | |
Original Plugin Name: Theme Updater | |
Original Plugin URI: https://github.com/UCF/Theme-Updater | |
Description: A theme updater for GitHub hosted Wordpress themes. This Wordpress plugin automatically checks GitHub for theme updates and enables automatic install. For more information read <a href="https://github.com/UCF/Theme-Updater/blob/master/readme.markdown">plugin documentation</a>. | |
Original Author: Douglas Beck | |
Original Version: 1.3.4 | |
Modified: 7/12/2012 | |
*/ |
This file contains 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 | |
add_action('wp_footer', 'print_the_filters', 30); | |
function print_the_filters() { | |
$hook_name = 'wp_enqueue_scripts'; | |
global $wp_filter; | |
var_dump( $wp_filter[$hook_name] ); | |
} |
This file contains 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 | |
if(is_admin()){ | |
//turn on admin notices which properly prints the global $errors objects detected errors | |
add_action('admin_notices', 'wlfw_admin_display_global_errors'); | |
} | |
//function: wlfw_errors_in_footer_admin | |
//description: used with admin_notices to display global errors | |
//optional parameters: none | |
function wlfw_admin_display_global_errors ($original_value) { |
This file contains 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 upgrader_source_selection_filter($source, $remote_source=NULL, $upgrader=NULL){ | |
/* | |
Github delivers zip files as <Username>-<TagName>-<Hash>.zip | |
must rename this zip file to the accurate theme folder | |
*/ | |
$upgrader->skin->feedback("Executing upgrader_source_selection_filter()..."); | |
if(isset($source, $remote_source, $upgrader->skin->theme)){ | |
$corrected_source = $remote_source . '/' . $upgrader->skin->theme . '/'; | |
if(@rename($source, $corrected_source)){ | |
return $corrected_source; |
This file contains 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
$timer = new timer(1); // constructor starts the timer, so no need to do it ourselves | |
/* | |
... mysql query ... | |
*/ | |
$query_time = $timer->get(); | |
/* | |
... page processing ... |
OlderNewer