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 | |
| // specify your css-files and their order here | |
| $cssFiles = array( | |
| 'normalize.css', 'style.css', 'print.css', 'colorbox.css' | |
| ); | |
| // the file to write the compressed css to | |
| $minFileName = 'minified.css'; | |
| // thats all, just call this file in your browser and it will | |
| // build you a minimized css-file. then just link to this single |
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
| // Remove p tags from images, scripts, and iframes. | |
| function remove_some_ptags( $content ) { | |
| $content = preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU', '\1\2\3', $content); | |
| $content = preg_replace('/<p>\s*(<script.*>*.<\/script>)\s*<\/p>/iU', '\1', $content); | |
| $content = preg_replace('/<p>\s*(<iframe.*>*.<\/iframe>)\s*<\/p>/iU', '\1', $content); | |
| return $content; | |
| } | |
| add_filter( 'the_content', 'remove_some_ptags' ); |
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 | |
| /** | |
| * Move image inside <p> tag above the <p> tag while preserving any link around image. | |
| * Can be prevented by adding any attribute or whitespace to <p> tag, e.g. <p class="yolo"> or even <p > | |
| */ | |
| function gc_remove_p_tags_around_images($content) | |
| { | |
| $contentWithFixedPTags = preg_replace_callback('/<p>((?:.(?!p>))*?)(<a[^>]*>)?\s*(<img[^>]+>)(<\/a>)?(.*?)<\/p>/is', function($matches) | |
| { | |
| /* |
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
| <html> | |
| <head> | |
| <title>Google Maps Multiple Markers</title> | |
| <script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script> | |
| </head> | |
| <body> | |
| <div id="map" style="height: 400px; width: 500px;"> | |
| </div> | |
| <script type="text/javascript"> |
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 | |
| /** | |
| * Get field key for field name. | |
| * Will return first matched acf field key for a give field name. | |
| * | |
| * ACF somehow requires a field key, where a sane developer would prefer a human readable field name. | |
| * http://www.advancedcustomfields.com/resources/update_field/#field_key-vs%20field_name | |
| * | |
| * This function will return the field_key of a certain field. |
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
| (function($) { | |
| $doc = $(document); | |
| $doc.ready( function() { | |
| /** | |
| * Retrieve posts | |
| */ | |
| function get_posts($params) { |
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 | |
| /** | |
| * Shortocde for displaying terms filter and results on page | |
| */ | |
| function vb_filter_posts_sc($atts) { | |
| $a = shortcode_atts( array( | |
| 'tax' => 'post_tag', // Taxonomy | |
| 'terms' => false, // Get specific taxonomy terms only | |
| 'active' => false, // Set active term by 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
| <?php | |
| /** | |
| * AJAC filter posts by taxonomy term | |
| */ | |
| function vb_filter_posts() { | |
| if( !isset( $_POST['nonce'] ) || !wp_verify_nonce( $_POST['nonce'], 'bobz' ) ) | |
| die('Permission denied'); | |
| /** |
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 | |
| /** | |
| * My Project | |
| * | |
| * @package MyProject | |
| * @subpackage JesGs_Walker_Category | |
| * @author Jess Green <jgreen@psy-dreamer.com> | |
| * @version $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
| <?php if (($wp_query->current_post +1) == ($wp_query->post_count)) { | |
| echo 'This is the last post'; | |
| } ?> | |
| <?php if (($wp_query->current_post +1) != ($wp_query->post_count)) { | |
| echo 'This is the not the last post'; | |
| } ?> |