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 | |
/** | |
* I'll write a function for this shortly | |
* | |
* */ | |
join(DIRECTORY_SEPARATOR,array( public_path(), "content", "source_files", "_translator", $new_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 | |
echo "Im about to pull the data.. Muh ... Shut your mouth"; | |
function pullTheData( $url, $county) { | |
$page = file_get_contents($url); | |
$doc = new DOMDocument(); | |
$doc->loadHTML($page); |
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 get_plugin_basepath() { | |
$path = explode("/", plugin_dir_path(__FILE__)); | |
$basePath = explode("/", plugin_basename(__FILE__)); | |
$pathKey = array_search($basePath[0], $path); | |
$newArray = array_slice(array_filter($path), 0, $pathKey); | |
$fullBasePath = implode("/", $newArray); | |
return "/" . $fullBasePath; |
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
/* | |
* When creating alias' and temp tables | |
* can't use where so use the | |
* HAVING keyword | |
*/ | |
SELECT | |
CONCAT(bill_first_name, ' ', bill_last_name) AS full_name, | |
COUNT(CONCAT(bill_first_name, ' ', bill_last_name)) AS amount, | |
MAX(ordered_on) as date, email |
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 | |
function explodeMeTwice ($param) { | |
$id_pieces = explode("&", $param); | |
$new_piece = array(); | |
foreach ($id_pieces as $piece) { | |
$the_piece = explode("=", $piece); | |
$new_piece[$the_piece[0]] = $the_piece[1]; |
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 | |
/* | |
* Orders - Custom Columns | |
*/ | |
add_filter( 'manage_edit-orders_columns', 'my_edit_orders_columns' ) ; | |
function my_edit_orders_columns( $columns ) { | |
$columns = array( |
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
/* | |
* Custom fields in custom admin columns | |
*/ | |
add_action( 'manage_orders_posts_custom_column', 'my_manage_orders_columns', 10, 2 ); | |
function my_manage_orders_columns( $column, $post_id ) { | |
global $post; | |
switch( $column ) { |
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
add_action( 'admin_init', 'redirect_non_admin_users' ); | |
/** | |
* Redirect non-admin users to home page | |
* | |
* This function is attached to the 'admin_init' action hook. | |
*/ | |
function redirect_non_admin_users() { | |
if ( ! current_user_can( 'manage_options' ) && '/wp-admin/admin-ajax.php' != $_SERVER['PHP_SELF'] ) { | |
wp_redirect( home_url() ); | |
exit; |
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
// Company Logo Image field | |
$att = my_update_attachment('user_photo', $post_id); | |
update_field('{field_key}', $att['attach_id'], $post_id); |
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 compare_distance($a,$b) | |
{ | |
if($a["details"]["distance"] == $b["details"]["distance"]) return 0; | |
return ($a["details"]["distance"] > $b["details"]["distance"]) ? 1 : -1; | |
} | |
usort($the_array, 'compare_distance'); |
OlderNewer