Skip to content

Instantly share code, notes, and snippets.

View flegfleg's full-sized avatar

Florian Egermann flegfleg

View GitHub Profile
@flegfleg
flegfleg / _menu-mobile.scss
Created May 10, 2014 15:01
mobile css menu - navigataur
/**************
NAVIGATAUR MENU - condensed
**************/
#toggle {display: none;}
.toggle {
z-index: 3;
display: block;
position: relative;
@flegfleg
flegfleg / full width menu - navigataur
Last active August 29, 2015 14:01
full css menu - navigataur
/**************
NAVIGATAUR MENU - full width
**************/
#toggle, .toggle {display: none;}
#toggle:checked ~ .top-nav {border-top:none;}
.top-nav{
z-index:2;
@flegfleg
flegfleg / WP_Query
Created May 11, 2014 13:39
use 'post_parent' => 0 in WP_Query to return only parent posts
$slider_query = new WP_Query( array( 'post_type' => 'wlw_projekte', 'orderby' => 'menu_order title', 'order' => 'DESC', 'post_parent' => 0 ));
$hide = get_post_meta( $post->ID, '_cmb_hideInList', true );
<?php
// get news
$args = array ('post_type'=> 'post', 'posts_per_page' => 5 );
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) :
while ( $the_query->have_posts() ) : $the_query->the_post();
get_template_part('news', 'compact');
endwhile; endif;
wp_reset_postdata();
?>
@flegfleg
flegfleg / WP CMB
Created May 18, 2014 22:09
WP get CMB field value
$value = get_post_meta( $post->ID, '_cmb_FIELDNAME', true );
(*
modification of a file from: http://www.lawschoolmatt.com/workflows/taskpaper-tasks-with-finder-links
The code for copying a clickable link is from Petesh at Stack Overflow. http://stackoverflow.com/questions/9617029/how-to-get-the-a-file-url-in-osx-with-applescript-or-a-shell-script
*)
global sel
global PageLink
tell application "Finder"
set sel to the selection as text
set PageLink to "file:///" & my path2url(POSIX path of sel)
@flegfleg
flegfleg / safely include files.php
Last active August 29, 2015 14:10
safely include files php
<?php
#########################################
# Script: Safely include files
#########################################
#
# Security measures:
# 1. First, use a regular expression to check if $seite contains anything but alphanumeric characters andunderscores
# 2. Check if the file exists before including
# 3. Include the file
@flegfleg
flegfleg / page-template.php
Created January 10, 2015 14:14
Page Template
<?php
/*
Template Name: My Custom Page
*/
?>
@flegfleg
flegfleg / vertical-align.scss
Created January 19, 2015 12:12
css mixin vertical align
@mixin vertical-align {
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
.element p {
@include vertical-align;