Skip to content

Instantly share code, notes, and snippets.

jQuery(function(){
jQuery("a[href*=\\#]").click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
&& location.hostname == this.hostname) {
var $target = jQuery(this.hash);
$target = $target.length && $target || jQuery('[name=' + this.hash.slice(1) +']');
if ($target.length) {
var targetOffset = $target.offset().top;
jQuery('html,body').animate({scrollTop: targetOffset}, 1000);
return false;
@mkwebworker
mkwebworker / placeholder-css
Created August 19, 2013 09:10
Placeholder Styling
::-webkit-input-placeholder { color:#f00; }
::-moz-placeholder { color:#f00; } /* firefox 19+ */
:-ms-input-placeholder { color:#f00; } /* ie */
input:-moz-placeholder { color:#f00; }
@mkwebworker
mkwebworker / wp_count_results
Created August 23, 2013 12:06
simple function to count search results. use it with wordpress default search.
/**
* Count Search Results
* http://marcokuemmel.de
**/
function count_results($return = false){
global $wp_query;
if($return == true )return $wp_query->found_posts;
else echo $wp_query->found_posts;
}
@mkwebworker
mkwebworker / register-cpt
Last active October 24, 2018 08:29
Register CPT #wordpress
/**
* Register CPT Gesellschaften ++++++++++++++++++++++++++++++++++++++++++++++++
*/
function gesellschaft_init() {
$labels = array(
'name' => 'Gesellschaften',
'singular_name' => 'Gesellschaft',
'add_new' => 'Hinzufügen',
'add_new_item' => 'Gesellschaft hinzufügen',
'edit_item' => 'Gesellschaft bearbeiten',
@mkwebworker
mkwebworker / bx-slider-scripts
Created October 4, 2013 11:53
enque bxslider scripts
// bxslider
wp_enqueue_script( 'bxslider-js', get_template_directory_uri() . '/js/bxslider/jquery.bxslider.min.js', array( 'jquery' ) );
wp_enqueue_style( 'bxslider', get_template_directory_uri().'/js/bxslider/jquery.bxslider.css' );
@mkwebworker
mkwebworker / add_post_thumb_column.php
Created October 10, 2013 11:28
Add a custom column with post thumbnail to the post overview
/* Add the post thumbnail to admin panel - marcokuemmel.de*/
function my_custom_column_content($column)
{
if ($column == 'featuredimage')
{
global $post;
echo (has_post_thumbnail($post->ID)) ? the_post_thumbnail(array(80,80)) : '<p>kein Bild festgelegt</p>' ;
}
}
// for cpt use manage_{$post_type}_posts_custom_column
@mkwebworker
mkwebworker / the_slideshow.php
Created October 16, 2013 08:31
basic function for slideshow - actually not ready
if( ! function_exists ( 'the_slideshow' )):
/*
* the_slideshow() - get slides from cpt 'slide' and echo or return them
@param array $args - contains serval options
*/
function the_slideshow( $args ) {
///// get arguments /////
// default arguments
@mkwebworker
mkwebworker / count_categorie_items.php
Created October 16, 2013 12:38
count items of a category
/**
* count_categorie_items :: count all items of a category :: returns false or the number of items
* @param string $category_slug :: slug of the category
* @param bool return :: return or echo
**/
function count_categorie_items( $category_slug, $return = false){
if( ! empty ($category_slug) ):
///// get category id & count their items /////
$cat = get_category_by_slug($category_slug);
@mkwebworker
mkwebworker / css-resets.css
Last active October 26, 2016 09:22
CSS Resets
a,abbr,acronym,address,applet,big,blockquote,body,caption,cite,code,dd,del,dfn,div,dl,dt,em,fieldset,font,form,h1,h2,h3,h4,h5,h6,html,iframe,ins,kbd,label,legend,li,object,ol,p,pre,q,s,samp,small,span,strike,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,tt,ul,var{border:0;font-family:inherit;font-size:100%;font-style:inherit;font-weight:inherit;margin:0;outline:0;padding:0;vertical-align:baseline}html{font-size:62.5%;overflow-y:scroll;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{background:#fff}article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}ol,ul{list-style:none}table{border-collapse:separate;border-spacing:0}caption,td,th{font-weight:400;text-align:left}blockquote:after,blockquote:before,q:after,q:before{content:""}blockquote,q{quotes:"" ""}a:focus{outline:dotted thin}a:active,a:hover{outline:0}a img{border:0}
/* ********************** */
/* ** IE 10 Detection *** */
/* ********************** */
var doc = document.documentElement;
doc.setAttribute('data-useragent', navigator.userAgent);
// example: html[data-useragent*='MSIE 10.0'] .site-content { background: #f00 }