Skip to content

Instantly share code, notes, and snippets.

View landru247's full-sized avatar

Landru landru247

  • Earth
View GitHub Profile
@landru247
landru247 / CSS: Menu Pipes
Created April 23, 2013 06:31
CSS: Menu Pipes
.nav > li { border-right: solid 1px #fff; }
.nav > li:last-of-type,.nav > li:last-child { border-right:none; }
@landru247
landru247 / CSS: Split UL into two cols
Created April 23, 2013 06:42
CSS: Split UL into two cols
ul li {float: left; width: 50%;}
@landru247
landru247 / HTML: IE Conditionals
Created April 23, 2013 06:50
HTML: IE Conditionals
<!--[if IE]>
According to the conditional comment this is IE<br />
<![endif]-->
<!--[if IE 6]>
According to the conditional comment this is IE 6<br />
<![endif]-->
<!--[if IE 7]>
According to the conditional comment this is IE 7<br />
<![endif]-->
<!--[if IE 8]>
@landru247
landru247 / WordPress: ACF - repeater output
Last active December 16, 2015 13:28
WordPress: ACF - repeater output
<?php while(the_repeater_field('foo')): ?>
<div >
<?php the_sub_field('foo_bar'); ?>
</div>
<?php endwhile; ?>
@landru247
landru247 / WordPress: AFC - checks if a value exists.
Last active December 16, 2015 13:59
WordPress: AFC - checks if a value exists.
<?php $values = get_field('foo'); ?>
<?php if($values) { ?>
{markup here}
<?php } ?>
@landru247
landru247 / WordPress: PHP ForEach Loop
Created April 24, 2013 16:50
WordPress: PHP ForEach Loop
<?php
$args = array( 'post_type' => '{cpt-name}', 'numberposts' => 4, '{taxomony-name}' => '{checked-item}' );
$lastposts = get_posts( $args );
foreach($lastposts as $post) : setup_postdata($post);
?>
<?php endforeach; ?>
@landru247
landru247 / WordPress: reset query
Created April 24, 2013 17:18
WordPress: reset query
<?php wp_reset_query(); ?>
@landru247
landru247 / WordPress: PHP - register custom widgets
Created April 24, 2013 17:20
WordPress: PHP - register custom widgets
// register custom widgets
if ( function_exists('register_sidebar') )
{
register_sidebar(array(
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<h2 class="widget title">',
'after_title' => '</h2>',
'name' => 'widget-1',
'id' => 'widget-1'
@landru247
landru247 / WordPress: PHP - while loop
Created April 24, 2013 17:20
WordPress: PHP - while loop
<?php $loop = new WP_Query(array( 'post_type' => '{post-name-here}' ) ); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<?php endwhile; ?>
@landru247
landru247 / WordPress: PHP - register custom menus
Created April 24, 2013 17:22
WordPress: PHP - register custom menus
// Creates custom menus
add_action( 'init', 'register_my_menus' );
function register_my_menus() {
register_nav_menus(
array(
'header-nav-1' => __( 'Top Nav' ),
'header-nav-2' => __( 'Header main' ),
'footer-nav' => __( 'Footer Nav' ),
'policy-nav'=> __('policy Nav')
)