Skip to content

Instantly share code, notes, and snippets.

@tjhole
tjhole / CSS: Cover Background
Created July 15, 2014 10:15
CSS: Cover Background
background: url(images/bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
@tjhole
tjhole / ACF: Gallery
Created July 14, 2014 13:21
ACF: Gallery
@tjhole
tjhole / ACF: Flexible Content
Created July 14, 2014 13:20
ACF: Flexible Content
<?php
// check if the flexible content field has rows of data
if( have_rows('flexible_content_field_name') ):
// loop through the rows of data
while ( have_rows('flexible_content_field_name') ) : the_row();
if( get_row_layout() == 'paragraph' ):
@tjhole
tjhole / ACF: Image
Last active July 10, 2016 00:13
ACF: Image
<?php
$attachment_id = get_sub_field('image');
$size = "full"; // (thumbnail, medium, large, full or custom size)
$image_url = wp_get_attachment_image_src( $attachment_id, $size );
?>
<?php echo $image_url[0]; ?>
@tjhole
tjhole / Repeater
Created July 14, 2014 13:19
ACF: Repeater
<?php
// check if the repeater field has rows of data
if( have_rows('repeater_field_name') ):
// loop through the rows of data
while ( have_rows('repeater_field_name') ) : the_row();
// display a sub field value
the_sub_field('sub_field_name');
@tjhole
tjhole / CSS: Transitions
Created July 10, 2014 11:39
CSS: Transitions
-webkit-transition: all 500ms ease-out 1s;
-moz-transition: all 500ms ease-out 1s;
-o-transition: all 500ms ease-out 1s;
transition: all 500ms ease-out 1s;
@tjhole
tjhole / WORDPRESS: Google Analytics Bouncer
Created June 30, 2014 10:51
WORDPRESS: Google Analytics Bouncer
function lxb_google_analytic_dashboard_bouncer() {
//is the GAD plugin active in the first place?
if(is_plugin_active('google-analytics-dashboard/google-analytics-dashboard.php')) {
//get the current user
$current_user_id=get_current_user_id();
//are you a super admin? if so, great
@tjhole
tjhole / PHP: If Mobile
Created June 22, 2014 10:53
PHP: If Mobile
function isMobile() {
return preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"]);
}
@tjhole
tjhole / ACF: Options Sub Pages
Created May 27, 2014 11:14
ACF: Options Sub Pages
function my_acf_options_page_settings( $settings )
{
$settings['title'] = 'Global';
$settings['pages'] = array('Header', 'Sidebar', 'Footer');
return $settings;
}
add_filter('acf/options_page/settings', 'my_acf_options_page_settings');
@tjhole
tjhole / WORDPRESS: Set Cookie Domain
Created May 12, 2014 07:22
WORDPRESS: Set Cookie Domain