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
<?php | |
// displays some comments for a certain url | |
$url = 'http://developers.facebook.com/docs/reference/fql/comment/'; | |
// fql multiquery to fetch all the data we need to display in one go | |
$queries = array('q1' => 'select post_fbid, fromid, object_id, text, time from comment where object_id in (select comments_fbid from link_stat where url ="'.$url.'")', | |
'q2' => 'select post_fbid, fromid, object_id, text, time from comment where object_id in (select post_fbid from #q1)', | |
'q3' => 'select name, id, url, pic_square from profile where id in (select fromid from #q1) or id in (select fromid from #q2)', | |
); |
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
//pass the function the MySQL standardized date and retreive a date relative to wordpress GMT and wordpress date and time display options | |
if(!function_exists('sm_display_date')) { function sm_display_date($mysqldate) { | |
$display_date = date_i18n( get_option('date_format').' '.get_option('time_format'),strtotime($mysqldate), get_option('gmt_offset') ); | |
return $display_date; | |
}} | |
//pass the function a UNIX TIMESTAMP or "Properly Formated Date/Time" and retreive a date formated for MySQL database date field type | |
//optionally pass a number of days to return a time XX days before or after the date/time sent | |
if(!function_exists('sm_mysql_date')) { function sm_mysql_date($time, $days = 0) { | |
$seconds = 60*60*24*$days; |
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
// now upload the new images | |
$postvals = cp_process_new_image($_POST['ad_id']); | |
// associate the already uploaded images to the ad and create multiple image sizes | |
$attach_id = cp_associate_images($_POST['ad_id'], $postvals['attachment']); | |
//process each image thats being uploaded | |
function cp_process_new_image() { | |
global $wpdb; | |
$postvals = ''; |