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 | |
/** | |
* is_parent | |
* | |
* @author JoseRobinson.com | |
* @link https://gist.github.com/jrobinsonc/e6098d90453d58f31793 | |
* @param int $pid | |
* @return bool | |
*/ |
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 hex2rgb($hex) | |
{ | |
$hex = str_replace("#", "", $hex); | |
if(strlen($hex) === 3) | |
{ | |
$r = hexdec(substr($hex,0,1).substr($hex,0,1)); | |
$g = hexdec(substr($hex,1,1).substr($hex,1,1)); | |
$b = hexdec(substr($hex,2,1).substr($hex,2,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 | |
class TimeZones { | |
/** | |
* @return array | |
*/ | |
public function generate() | |
{ | |
$identifiers = DateTimeZone::listIdentifiers(); |
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 | |
/** | |
* imagettftext_in_lines | |
* | |
* @author JoseRobinson.com | |
* @link https://gist.github.com/jrobinsonc/699ea6fadd7369146574 | |
* @version 201502131102 | |
* @param $image An image resource, returned by one of the image creation functions, such as imagecreatetruecolor(). | |
* @param $font_size The font size. Depending on your version of GD, this should be specified as the pixel size (GD1) or point size (GD2). |
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 | |
/** | |
* Return an absolute URL. | |
* | |
* Usage: | |
* [get_url page=<page id>] | |
* | |
* or | |
* |
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 | |
// Use shortcodes within text widgets | |
add_filter('widget_text', 'do_shortcode'); | |
// wp_nav_menu | |
add_shortcode('wp_nav_menu', 'wp_nav_menu_shortcode'); | |
function wp_nav_menu_shortcode($atts = array(), $content = '') | |
{ |
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
_ |
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 | |
/** | |
* get_file_url | |
* | |
* Usage example: | |
* | |
* URL relative to the base file: | |
* get_file_url('styles.css', __FILE__); | |
* |
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 get_the_slug() | |
{ | |
global $post; | |
return is_single() || is_page()? $post->post_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 | |
##################################################### | |
# Example to show most visited posts. | |
##################################################### | |
$custom_query = new WP_query(array( | |
'meta_key' => Posts_views::$key, | |
'orderby' => 'meta_value_num', | |
'order' => 'DESC' |