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
| /*********************************************** | |
| Gradients | |
| ***********************************************/ | |
| @mixin gradient($from, $to) { | |
| background: -webkit-gradient(linear, left top, left bottom, from($from), to($to)); | |
| background: -moz-linear-gradient(top, $from, $to); | |
| filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{$from}', endColorstr='#{$to}'); | |
| } | |
| //Usage |
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 | |
| function seoFriendly($string, $separator) { | |
| //Only accept dashes or underscores | |
| if( $separator == "-" || $separator == "_" ) { | |
| $separator = $separator; | |
| } else { | |
| $separator = "-"; | |
| } |
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
| /***************************************************** | |
| *** Get all taxonomy terms for a post *** | |
| *****************************************************/ | |
| get_the_term_list( $post->ID, 'taxonomy_name' ); //Returns links | |
| get_the_term_list( $post->ID, 'taxonomy_name', '', ', ', '' ); //Returns links separated by commas | |
| strip_tags(get_the_term_list( $post->ID, 'taxonomy_name' )); //Returns text | |
| /***************************************************** | |
| *** Get custom fields for a post *** |
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 | |
| function splitStringByWords($x, $string) { | |
| //Convert the string | |
| $converted_string = explode( "\n", wordwrap( $string, $x)); | |
| //Return the array of split strings | |
| return $converted_string; | |
| } | |
| //Number of characters the split will occur after |
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 | |
| /*********************************************************************************** | |
| These are examples and references for the WooCommerce Order Item meta data hooks | |
| that is displayed in the admin side of WordPress when viewing a customer's order. | |
| ***********************************************************************************/ | |
| //Do Something before the order item's meta data | |
| do_action( 'woocommerce_before_order_itemmeta', $item_id, $item, $_product ); | |
| //Do Something after the order item's meta data |
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
| //echo the current filename | |
| echo basename(__FILE__); | |
| //echo current filename without extension | |
| echo basename(__FILE__, '.php'); | |
| //Echo the current URL | |
| echo "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; |
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 | |
| /* | |
| The functions below will work in wordpress 4.4 and greater. | |
| These functions allow you to add, get, and update meta data for terms/taxonomies. | |
| */ | |
| /* | |
| *** Add Meta Data To A Term |
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 | |
| function prepare_url($string) { | |
| //Check if the string starts with http or https | |
| if (substr($string, 0, 7) == "http://" OR substr($string, 0, 8) == "https://") { | |
| $url = $string; | |
| } else { | |
| //Remove any presence of http:// or https:// from the link | |
| $string = str_replace("://", "", $string); |
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 | |
| function checkForRedirects($URL) { | |
| $ch = curl_init($URL); | |
| curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); | |
| curl_exec($ch); | |
| $original_status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); | |
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
| //Check if packages are installed | |
| dpkg --get-selections | grep [package_name] | |
| //Show a list of files and directories in the current directory. | |
| ls | |
| //Show file permissions | |
| ls -l /avr/www/html/index.php | |
| //Edit a file |