Skip to content

Instantly share code, notes, and snippets.

View emaildano's full-sized avatar
🏄‍♀️
Surfing the information superhighway

Dano emaildano

🏄‍♀️
Surfing the information superhighway
  • Philadelphia, PA
View GitHub Profile
@emaildano
emaildano / acf-yoast-add-on.php
Created January 31, 2014 02:51
Add ACFs to Yoast SEO page analysis.
function add_custom_content_to_analysis( $content ) {
global $post;
$custom = get_post_custom( $post->ID );
$custom_content = '';
foreach( $custom as $field )
{
$custom_content .= $field[0].' ';
}
return $content . ' ' . $custom_content;
}
@emaildano
emaildano / is-home-or-single.php
Created January 29, 2014 20:10
Conditional snippet for blog page and blog post
<?php if (is_home() || is_single()) { ?>
<?php } else { ?>
<?php } ?>
@emaildano
emaildano / first-acf-repeater-image.php
Created January 28, 2014 20:21
Get first image in ACF repeater field
<?php
$first_img = true;
while($first_img && has_sub_field('post_images')): ?>
<a href="<?php the_permalink(); ?>">
<img class="img-responsive" src="<?php
$image = get_sub_field('image');
echo $image['sizes']['blog-lg'];
?>" alt="<?php echo $image['alt']; ?>" />
<?php $first_img = false; ?>
@emaildano
emaildano / custom-excerpts-front-end.php
Created January 28, 2014 19:01
Function for custom content / excerpt lengths by using "echo excerpt(20);" or "echo content(20);"
<?php echo excerpt(20); ?>
<?php echo content(20); ?>
@emaildano
emaildano / underline-words.css
Created January 22, 2014 16:00
Script and style to underline individual words.
h1 span {
text-decoration: underline;
}
@emaildano
emaildano / flexslider-progress-bar.html
Created January 21, 2014 21:07
Progress bar add on for FlexSlider
<div class="progress_bar_container">
<div class="progress_bar"></div>
</div>
@emaildano
emaildano / back-to-top.css
Last active January 3, 2016 19:59
Button for scrolling back to top. Hides before scrolling down.
.back-to-top {
visibility:hidden;
}
@emaildano
emaildano / round-font-awesome-icon-set.html
Last active January 3, 2016 19:19
Round social media icon set.
<ul class="fa-round-icons">
<li class="fa-round-icon fa-2x"><a target="_blank" href="#"><i class="fa fa-twitter"></i></a></li>
<li class="fa-round-icon fa-2x"><a target="_blank" href="#"><i class="fa fa-facebook"></i></a></li>
<li class="fa-round-icon fa-2x"><a target="_blank" href="#"><i class="fa fa-instagram"></i></a></li>
</ul>
@emaildano
emaildano / most recent post from category
Created January 17, 2014 19:38
Grab the most recent post from a category. This example is from Griggstown farm.
<?php
$args = array( 'numberposts' => 1, 'category_name' => 'food-of-the-week' );
$postslist = get_posts( $args );
foreach ($postslist as $post) : setup_postdata($post); ?>
<h4><?php the_time('D, F jS, Y') ?></h4>
<h3><?php the_title(); ?></h3>
<p><?php echo bm_better_excerpt(431, ' ... ') ?></p>
<a href="<?php the_permalink(); ?>">Learn More</a>
@emaildano
emaildano / Empty PHP Variable
Created January 17, 2014 16:21
If PHP variable is empty.
if($variable !== '') {
echo $variable;
}