Skip to content

Instantly share code, notes, and snippets.

View ajuliano's full-sized avatar

Albert Johansson ajuliano

View GitHub Profile
@ajuliano
ajuliano / .gitignore
Last active August 15, 2018 11:16
Recommended .gitignore for WP Engine
*~
wp-content/*
!wp-content/themes/
wp-content/themes/*
# Change THEMENAME to the current theme name
!wp-content/themes/THEMENAME/*
wp-content/themes/THEMENAME/.sass-cache/*
@ajuliano
ajuliano / head-wordpress
Last active July 5, 2017 14:12
Standard head on in WordPress-projects
<!doctype html>
<html <?php language_attributes(); ?> class="no-js <?php echo wp_is_mobile() ? 'mobile' : ''; ?>">
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
@ajuliano
ajuliano / utilities
Last active November 29, 2016 07:44
/*
* https://css-tricks.com/snippets/css/truncate-string-with-ellipsis/
*
*/
.u-truncate {
width: 250px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@ajuliano
ajuliano / wpadverts-mal-fix-location-dropdown-bug
Created October 4, 2016 22:08
The autocomplete form in the wpadverts-mal plugin triggers the submit button when pushing Enter when a location is selected in the dropdown, but the location is not saved.
/*
* Added on line 139 in the file wpadverts-mal/assets/js/map-single.js in plugin version 1.1.1
*/
google.maps.event.addDomListener(input, 'keydown', function(e) {
if (e.keyCode == 13) {
e.preventDefault();
}
});
@ajuliano
ajuliano / polylang och ACF Options Page
Last active September 19, 2018 14:42
polylang och ACF Options Page
/*
* Få Polylang och ACF Options Page att fungera
*
* http://www.advancedcustomfields.com/resources/multilingual-custom-fields/ (Längst ned på sidan)
*/
add_filter('acf/settings/default_language', function( $language ) {
if ( function_exists( 'pll_current_language' ) ) {
@ajuliano
ajuliano / browsehappy-function
Created December 15, 2014 16:18
Surfa Lyckligt (Browsehappy) i WordPress-tema
/**
* Browsehappy
*
* Information om föråldrar webbläsare till besökare med lte IE8.
*
*/
function intervaro_browsehappy() {
$output = '
<!--[if lte IE 8]>
<p class="browsehappy" style="background-color: #333; position: absolute; top: 0; left: 0; right: 0; padding: 12px 24px; margin: 0; color: #FFF;z-index: 1000;">Du använder en <strong>föråldrad</strong> webbläsare. Alla funktioner fungerar inte i din webbläsare. Var vänlig <a href="http://browsehappy.com/" style="color: #FFF;">uppgradera din webbläsare</a> för att förbättra din upplevelse och öka din säkerhet.</p>
@ajuliano
ajuliano / Clickable svg in a-tag
Last active July 31, 2017 20:13
Make SVG clickable in a-tag and with image fallback
/**
* Make SVG clickable in a-tag and with image fallback (perfect for logotypes)
*
* HTML:
* <a href="http://dystonia-europe.org" target="_blank" class="u--svg-inside">
* <object data="svg-image.svg" type="image/svg+xml"> <img src="fallback-image.png" /> </object>
* </a>
*
*/
@ajuliano
ajuliano / gist:6297291
Last active December 21, 2015 11:09
Supersmart information to know
Always specify viewport to get the perfect svg: http://www.boogdesign.com/examples/svg/svg-as-image.html
Poor mans nth child selector: http://abouthalf.com/development/poor-mans-nth-child-selector-for-ie-7-and-8/
SVG fallbacks: http://css-tricks.com/svg-fallbacks/
@ajuliano
ajuliano / external-link-symbol
Created July 24, 2013 12:55
External Link Symbol
@ajuliano
ajuliano / Drop Shadoq IE
Last active December 11, 2015 16:08
Drop Shadow för ≤ IE 8
/*
* Drop Shadow för ≤ IE 8 (IE 8 lägger på höjd, därför svår att använda i vissa lägen.)
*
* http://msdn.microsoft.com/en-us/library/ms533086%28VS.85,loband%29.aspx
*/
filter: progid:DXImageTransform.Microsoft.Shadow(color=#DDDDDD,direction=-45) progid:DXImageTransform.Microsoft.Shadow(color=#DDDDDD,direction=45);