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(function($) { | |
| // get vertical offset of element by selector | |
| var getElOffset = function(selector) { | |
| var offset; | |
| if(selector === '#top') { | |
| return 0; | |
| } else { | |
| offset = $(selector).offset(); | |
| if(typeof offset === 'undefined') return false; |
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 | |
| // Remove default image sizes we don't need | |
| add_filter( 'intermediate_image_sizes_advanced', function ( $sizes ) { | |
| unset( $sizes['thumbnail']); // 150px | |
| unset( $sizes['medium']); // 300px | |
| unset( $sizes['large']); // 1024px | |
| unset( $sizes['medium_large']); // 768px | |
| return $sizes; | |
| }); |
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 | |
| /** | |
| * Link sitemap in robots.txt | |
| */ | |
| add_filter('robots_txt', function($robots) { | |
| if(get_option( 'blog_public' )) { | |
| // add sitemap link | |
| $robots .= "\nSitemap: " . site_url() . "/sitemap_index.xml\n"; | |
| } | |
| return $robots; |
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 | |
| // /app/helpers.php: | |
| function flash($message, $status = 'info') { | |
| session()->flash('flash_message', $message); | |
| session()->flash('flash_message_status', $status); | |
| } |
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 excerpt out of the loop | |
| function my_excerpt($post_id) { | |
| $post = get_post($post_id); | |
| if ($post->post_excerpt) { | |
| // excerpt exists, return it | |
| return apply_filters('the_excerpt', $the_post->post_excerpt); | |
| } else { | |
| setup_postdata( $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 | |
| // replace content filtered entities back, as certain characters are not defined in Ubuntu font | |
| add_filter('the_content', 'sw_replace_quotes_back', 100); | |
| add_filter('wpp_post', 'sw_replace_quotes_back', 100); | |
| add_filter('acf/load_value', 'sw_replace_quotes_back', 100); | |
| add_filter('acf/format_value_for_api', 'sw_replace_quotes_back', 100); | |
| add_filter('the_title', 'sw_replace_quotes_back', 100); | |
| function sw_replace_quotes_back($str) { | |
| $search = array('’', '’', '“', '”', '“', '”'); |
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 | |
| // custom text translations | |
| add_filter( 'gettext', function( $translated_text, $text, $domain ) { | |
| $translations = array( | |
| 'qode' => array( | |
| 'view' => 'read more', | |
| ), | |
| 'wpgmp_google_map' => array( | |
| 'Enter address or latitude or longitude or title or city or state or country or postal code here...' => 'Suburb, Town, City' | |
| ), |
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 | |
| /* Script to migrate all data from storeview 1 to Default Scope (storeview 0) | |
| @author - Jan Zikmund | |
| */ | |
| $store_from = 1; | |
| $store_to = 0; | |
| $tables = array( | |
| 'catalog_product_entity_varchar', | |
| 'catalog_product_entity_text', |
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
| // extend jquery by external links selector | |
| jQuery.extend( jQuery.expr[':'], { | |
| external: function(obj) { | |
| return !obj.href.match(/^mailto\:/) && (obj.hostname != location.hostname) && !obj.href.match(/^javascript\:/) && !obj.href.match(/^$/); | |
| } | |
| }); | |
| jQuery(document).ready(function() { | |
| // automatically open external links to new window | |
| jQuery('a:external').attr('target', '_blank'); |