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 | |
// In this brief example we'll scrape an Instagram post and save it as a WordPress post | |
// Go to a URL and get the contents back | |
// See https://developer.wordpress.org/reference/functions/wp_remote_get/ | |
$instagram_request = wp_remote_get( 'https://www.instagram.com/p/BSBvNVIF8tI/' ); | |
// If it's succesful, the payload of the request will be in $instagram_request['body'] | |
$instagram_html = $instagram_request['body']; |
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
{ | |
"files": | |
{ | |
"jquery" : "http://code.jquery.com/jquery.js", | |
"jquery.min" : "http://code.jquery.com/jquery.min.js", | |
"jquery-cookie" : "https://raw.github.com/carhartl/jquery-cookie/master/jquery.cookie.js", | |
"jquery-dotimeout" : "https://raw.github.com/cowboy/jquery-dotimeout/master/jquery.ba-dotimeout.min.js", | |
"jquery-extra-selectors" : "https://raw.github.com/keithclark/JQuery-Extended-Selectors/master/jquery-extra-selectors.js", | |
"jquery-flexslider" : "https://raw.github.com/mbmufffin/FlexSlider/master/jquery.flexslider-min.js", | |
"jquery-mediaelement" : "https://raw.github.com/johndyer/mediaelement/master/build/mediaelement-and-player.js", |
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 | |
$categories = get_the_category(); | |
// Assemble a tree of category relationships | |
// Also re-key the category array for easier | |
// reference | |
$category_tree = array(); | |
$keyed_categories = 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
Category: | |
pagination | |
category links | |
sidebar: child category | |
Sub Category 1 (eg. Interior) | |
category title | |
pagination | |
Portfolio/ Product |
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
/**********************************************/ | |
/* | |
/* IR_Black Skin by Ben Truyman - 2011 | |
/* | |
/* Based on Todd Werth's IR_Black: | |
/* http://blog.toddwerth.com/entries/2 | |
/* | |
/* Inspired by Darcy Clarke's blog post: | |
/* http://darcyclarke.me/design/skin-your-chrome-inspector/ | |
/* |
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 ajx_sharpen_resized_files( $resized_file ) { | |
$image = wp_load_image( $resized_file ); | |
if ( !is_resource( $image ) ) | |
return new WP_Error( 'error_loading_image', $image, $file ); | |
$size = @getimagesize( $resized_file ); | |
if ( !$size ) | |
return new WP_Error('invalid_image', __('Could not read image size'), $file); | |
list($orig_w, $orig_h, $orig_type) = $size; |
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
// A conditional function to check if the current page is a descendant of the ID given to it. Useful for determining if a page is a grandchild, great-grandchild or father down the hierarchy tree. | |
function is_tree($pid) { // $pid = The ID of the page we're looking for pages underneath | |
global $post; // load details about this page | |
$anc = get_post_ancestors( $post->ID ); | |
foreach($anc as $ancestor) { | |
if(is_page() && $ancestor == $pid) { | |
return true; | |
} |
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
// customize admin footer text | |
function custom_admin_footer() { | |
echo 'add your custom footer text and html here'; | |
} | |
add_filter('admin_footer_text', 'custom_admin_footer'); |
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 fb_disable_feed() { | |
wp_die( __('No feed available,please visit our <a href="'. get_bloginfo('url') .'">homepage</a>!') ); | |
} | |
add_action('do_feed', 'fb_disable_feed', 1); | |
add_action('do_feed_rdf', 'fb_disable_feed', 1); | |
add_action('do_feed_rss', 'fb_disable_feed', 1); | |
add_action('do_feed_rss2', 'fb_disable_feed', 1); | |
add_action('do_feed_atom', 'fb_disable_feed', 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
if(extension_loaded("zlib") && (ini_get("output_handler") != "ob_gzhandler")) | |
add_action('wp', create_function('', '@ob_end_clean();@ini_set("zlib.output_compression", 1);')); |
NewerOlder