Skip to content

Instantly share code, notes, and snippets.

@ingozoell
ingozoell / body-class.browser-detection.php
Created January 21, 2014 13:41
Add Browser-Detection to Wordpress body_class
// Add Browser-Detection
function mv_browser_body_class($classes) {
global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;
if($is_lynx) $classes[] = 'lynx';
elseif($is_gecko) $classes[] = 'gecko';
elseif($is_opera) $classes[] = 'opera';
elseif($is_NS4) $classes[] = 'ns4';
elseif($is_safari) $classes[] = 'safari';
elseif($is_chrome) $classes[] = 'chrome';
<?php
$myArray = array();
foreach ($this->sinonimo as $s){
$myArray[] = '<span>'.ucfirst($s->sinonimo).'</span>';
}
echo implode( ', ', $myArray );
/* OUTPUT
* <span>Text1<span>, <span>Text2<span>, <span>Text3<span>
@ingozoell
ingozoell / css3-prefixer-plus.less
Created January 29, 2014 20:31
LESS Prefixer+
//---------------------------------------------------
// LESS Prefixer
//---------------------------------------------------
//
// All of the CSS3 fun, none of the prefixes!
//
// As a rule, you can use the CSS properties you
// would expect just by adding a '.':
//
// box-shadow => .box-shadow(@args)
@ingozoell
ingozoell / mobile-detection.js
Created February 5, 2014 14:09
Javascript – Mobile Detection
///////////////////////////////
// Mobile Detection
///////////////////////////////
function isMobile(){
return (
(navigator.userAgent.match(/Android/i)) ||
(navigator.userAgent.match(/webOS/i)) ||
(navigator.userAgent.match(/iPhone/i)) ||
(navigator.userAgent.match(/iPod/i)) ||
(navigator.userAgent.match(/iPad/i)) ||
/** * Load jQuery from Google CDN, fallback to local */// http://wp.tutsplus.com/tutorials/load-jquery-from-google-cdn-with-local-fallback-for-wordpress/if( !is_admin()){ // Don't do this for admin area, since Google's jQuery isn't in noConflict mode and will interfere with WP's admin area. $url = 'http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js'; // the URL to check against $test_url = @fopen($url,'r'); // test parameters if($test_url !== false) { // test if the URL exists function load_external_jQuery() { // load external file wp_deregister_script( 'jquery' ); // deregisters the default WordPress jQuery wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js'); // register the external file wp_enqueue_script('jquery'); // enqueue the external file } add_action('wp_enqueue_scripts', 'load_external_jQuery'); // initiate the function } else { function load_local_jQuery() { wp_deregister_script('jquery'); // dereg
$(".panel").toggle(
function()
{
$(this).animate({width:'300px',height:'300px'}, 200);
},
function()
{
$(this).animate({width:'152px',height:'152px'}, 200);
}
);
@ingozoell
ingozoell / Add-Page-Attributes-to-custom-post-types.php
Created February 22, 2014 16:39
Add Page Attributes to custom post types
// Register CPT
Add 'page-attributes'
// 'supports' => array( 'title', 'editor','thumbnail','page-attributes' )
// Landingpage/Template
Add '&orderby=menu_order'
//$portfolio_query = new WP_Query( 'post_type=portfolio&orderby=menu_order&posts_per_page=-1' );
@ingozoell
ingozoell / wordpress-debug.php
Created March 22, 2014 15:19
WP_DEBUG_LOG: Fehlermeldungen für produktive WordPress-Seiten ausgeben From http://marketpress.de/2014/wp-debug-log-fehlermeldungen-in-wordpress-ausgeben/
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', true );
@ingozoell
ingozoell / meta-icons-favicons-win8-tiles.html
Created March 31, 2014 13:57
Icons, Favicons, Windowes 8 Tiles
<!-- ****** faviconit.com favicons ****** -->
<!-- Basic favicons -->
<link rel="shortcut icon" sizes="16x16 32x32 48x48 64x64" href="/favicon.ico">
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
<!--[if IE]><link rel="shortcut icon" href="/favicon.ico"><![endif]-->
<!-- For Opera Speed Dial -->
<link rel="icon" type="image/png" sizes="195x195" href="/favicon-195.png">
<!-- For iPad with high-resolution Retina Display running iOS ≥ 7 -->
<link rel="apple-touch-icon" sizes="152x152" href="/favicon-152.png">
<!-- For iPad with high-resolution Retina Display running iOS ≤ 6 -->
@ingozoell
ingozoell / wordpress-head-meta.php
Last active October 13, 2016 09:35
WordPress head.php (Meta) Doctype
<?php // Alternate without "404.php" if(is_404()) {header('Location: ' . esc_url(home_url('/')), true, 301);} ?>
<!doctype html>
<!--[if lt IE 7]> <html <?php body_class( 'no-js ie6 ie6-7 oldie' ); ?> <?php language_attributes(); ?>> <![endif]-->
<!--[if IE 7]> <html <?php body_class( 'no-js ie7 ie6-7 oldie' ); ?> <?php language_attributes(); ?>> <![endif]-->
<!--[if IE 8]> <html <?php body_class( 'no-js ie8 oldie' ); ?> <?php language_attributes(); ?>> <![endif]-->
<!--[if IE 9 ]> <html <?php body_class( 'no-js ie9' ); ?> <?php language_attributes(); ?>> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--> <html <?php body_class( 'no-js' ); ?> <?php language_attributes(); ?>> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">