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
// 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'); |
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 | |
/** | |
* Changes WordPress posts URL structure, so that in results in following: | |
* | |
* Articles overview: /articles/ | |
* Category overview: /articles/europe | |
* Article detail: /articles/europe/title | |
* Tag detail: /articles/tag/work | |
* | |
* Requires following settings of Permalinks: |
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 | |
// 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 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 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 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 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 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 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 | |
// from ACF | |
if($image = get_field('photo')): ?> | |
<?php ps_responsive_image($image, 'large', '(min-width: 1160px) 173px, (min-width: 1024px) calc(25vw - 117px), (min-width: 768px) calc(25vw - 72px), 150px'); ?> | |
<?php endif | |
// featured image as variable | |
if (has_post_thumbnail( get_the_id() ) ) { | |
$profile_image_html = ps_get_responsive_image(get_post_thumbnail_id( get_the_id() ), 'team-profile', '(min-width: 768px) 90px, 140px'); | |
} |
OlderNewer