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 | |
| class Sizeable_Person | |
| { | |
| const POST_TYPE_SLUG = 'szbl-person'; | |
| public static $instance; | |
| public static function init() | |
| { | |
| if ( is_null( self::$instance ) ) |
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 wpe_noRedirectUrl($srcURL) | |
| { | |
| if (class_exists('WpeCommon')) { | |
| global $wpe_netdna_domains; | |
| static $cdn_domain; | |
| if (!isset($cdn_domain)) { | |
| $wpe_common = new WpeCommon(); | |
| if ($wpe_common->is_cdn_enabled()) { |
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 to get a blog/site's domain mapped url. | |
| // | |
| // You need to call it with a blog ID | |
| // | |
| // Example: | |
| // $custom_blog_id = '14'; | |
| // echo get_domain_mapped_url( $custom_blog_id ); | |
| // |
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
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
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
| /* the regex pattern will look for an image tag and create individual capture groups | |
| * for 'class'(1), 'src'(2), 'alt'(3), 'width'(4) and 'height'(5). The numbers within the brackets stand for the capture group number | |
| * respectively the key within the PHP array. The array key 0 will contain the whole <img> tag with all attributes (the full img link) | |
| * First we define the pattern, then we use the PHP function 'preg_match_all' fo find all occurences within the given string. */ | |
| $pattern = '/<img\s*(?:class\s*\=\s*[\'\"](.*?)[\'\"].*?\s*|src\s*\=\s*[\'\"](.*?)[\'\"].*?\s*|alt\s*\=\s*[\'\"](.*?)[\'\"].*?\s*|width\s*\=\s*[\'\"](.*?)[\'\"].*?\s*|height\s*\=\s*[\'\"](.*?)[\'\"].*?\s*)+.*?>/si'; | |
| preg_match_all($pattern, $item->fulltext, $matches); | |
| /* as an example we iterate through the list of image sources (src) and build up a custom image link. We needed this in order to create | |
| * proper a links from images in order to be able to use fancybox for opening images that were added in an article in Joomla */ | |
| foreach |
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 | |
| /** | |
| * Returns all img tags in a HTML string with the option to include img tag attributes | |
| * | |
| * @author Joshua Baker | |
| * | |
| * @example $post_images[0]->html = <img src="example.jpg"> | |
| * $post_images[0]->attr->width = 500 | |
| * |
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 | |
| add_filter( 'allowed_http_origins', 'my_add_origins' ); | |
| function my_add_origins( $origins ) { |
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 | |
| /* | |
| * Virtual Themed Page class | |
| * | |
| * This class implements virtual pages for a plugin. | |
| * | |
| * It is designed to be included then called for each part of the plugin | |
| * that wants virtual pages. | |
| * | |
| * It supports multiple virtual pages and content generation functions. |
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
| jQuery(document).ready(function($) { | |
| $.get( "wp-json/wp/v2/posts", function( data ) { | |
| $.each( data, function( i, val ) { | |
| $( "#app" ).append( | |
| '<li>' + | |
| '<h3>' + | |
| val.title.rendered + | |
| '</h3>' + | |
| '<p>' + | |
| val.excerpt.rendered + |