Skip to content

Instantly share code, notes, and snippets.

@ingozoell
ingozoell / doubleTapToGo.js
Last active December 20, 2017 15:08
Drop-Down Navigation: Responsive and Touch-Friendly (moseover, hover) https://osvaldas.info/drop-down-navigation-responsive-and-touch-friendly
/*
By Osvaldas Valutis, www.osvaldas.info
Available for use under the MIT License
*/
;(function( $, window, document, undefined ) {
$.fn.doubleTapToGo = function( params ) {
if( !( 'ontouchstart' in window ) &&
!navigator.msMaxTouchPoints &&
!navigator.userAgent.toLowerCase().match( /windows phone os 7/i ) ) return false;
add_action( 'admin_menu', 'default_published_wpse_91299' );
function default_published_wpse_91299()
{
global $submenu;
// POSTS
foreach( $submenu['edit.php'] as $key => $value ) {
if( in_array( 'edit.php', $value ) ) {
$submenu['edit.php'][ $key ][2] = 'edit.php?post_status=publish&post_type=post';
}
@ingozoell
ingozoell / wp-email-spam-protection.php
Last active September 29, 2016 16:44
WordPress E-Mail Spam Protection via Shortcode Hide Email from Spam Bots using a shortcode place this in your functions file
/* Shortcode spam-protected HTML "mailto"
* [email]
*
*/
function iz_email_protection($atts , $content = null ){
if ( ! is_email ($content) )
return;
return '<a href="mailto:'.antispambot($content).'">'.antispambot($content).'</a>';
}
html {
display: table;
height: 100%;
width: 100%;
text-align: center;
}
body {
display: table-cell;
vertical-align: middle;
[class*="col-"] {
float: none;
display: inline-block;
margin: 0 -0.125em;
vertical-align: top;
}
@ingozoell
ingozoell / wp_remove_unused_archive_pages.php
Last active August 19, 2024 02:40
WordPress: Remove unused archive Pages (tax, cat ) and redirect 404
/*
function taxonomies_redirect() {
if( is_tax('filter') ) {
wp_redirect( home_url('/fotouebersicht/'), 301 );
exit;
}
}
add_action( 'template_redirect', 'taxonomies_redirect' );
*/
/**
* Create a shortcode to insert content of a page of specified ID
*
* @param array attributes of shortcode
* @return string $output Content of page specified, if no page id specified output = null
*/
function pa_insertPage($atts, $content = null) {
// Default output if no pageid given
$output = NULL;
@ingozoell
ingozoell / clean-up-output-of-stylesheet.php
Created May 8, 2014 20:24
Clean up output of stylesheet
/*
------------------------------------------------------------------------------------------
Clean up output of stylesheet <link> tags
------------------------------------------------------------------------------------------ */
function my_clean_style_tag($input) {
preg_match_all("!<link rel='stylesheet'\s?(id='[^']+')?\s+href='(.*)' type='text/css' media='(.*)' />!", $input, $matches);
// Only display media if it is meaningful
$media = $matches[3][0] !== '' && $matches[3][0] !== 'all' ? ' media="' . $matches[3][0] . '"' : '';
return '<link rel="stylesheet" href="' . $matches[2][0] . '"' . $media . '>' . "\n";
}
@Jakobud
Jakobud / bootstrap-ms.scss
Last active June 15, 2022 12:42 — forked from andyl/bootstrap_ms.css.scss
Adds in the missing 480px-797px breakpoint range to Bootstrap 3 for SASS
// Bootstrap Mid-Small - col-ms-* - the missing grid set for Bootstrap3.
//
// This is a hack to fill the gap between 480 and 767 pixels - a missing range
// in the bootstrap responsive grid structure. Use these classes to style pages
// on cellphones when they transition from portrait to landscape.
//
// Contains:
// Columns, Offsets, Pushes, Pulls for the Mid-Small layout
// Visibility classes for the Mid-Small layout
// Redefined visibility classes for the Extra Small layout
@tomblanchard
tomblanchard / mini-modernizr.html
Created April 25, 2014 14:09
Mini Modernizr: I only ever use Modernizr mostly to check for JS and / or touch screen devices. This tiny piece of code will replace the classes which are on the `<html>` element `no-js` with `js` and `no-touch` with `touch`.
<script>!function(a,b){"use strict";b.documentElement.className=b.documentElement.className.replace("no-js","js"),("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)&&(document.documentElement.className=document.documentElement.className.replace("no-touch","touch"))}(window,document);</script>