Skip to content

Instantly share code, notes, and snippets.

View aibrean's full-sized avatar

April Sadowski aibrean

View GitHub Profile
@aibrean
aibrean / css_resources.md
Created June 6, 2014 15:22 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@aibrean
aibrean / wordpress-href.php
Created July 21, 2014 17:27
Adds _blank target to PDF files in WP page content
echo str_replace('.pdf"', '.pdf" target="_blank"', get_the_content());
//may have a parameter in the get_the_content function.
@aibrean
aibrean / functions.php
Created July 30, 2014 20:25
Limit visibility of posts/media by users
//pages and media library pages
function hide_posts_media_by_other($query) {
global $pagenow;
if( ( 'edit.php' != $pagenow && 'upload.php' != $pagenow ) || !$query->is_admin ){
return $query;
}
if( !current_user_can( 'manage_options' ) ) {
global $user_ID;
<?php
/**
* Remove inactive shortcodes
*
* Make sure inactive shortcodes don't leave their junk in the content.
* We are striping their tags, leaving content as is. This function is attached to
* 'the_content' filter hook.
*
* @global $shortcode_tags Associative array of all active shortcodes.
* [key] => value
@aibrean
aibrean / image-array.php
Last active March 25, 2024 07:25
Demystifying the ACF image field. ACF (Advanced Custom Fields) allows users to use an ID, array, or URL for images. Once the field is set up in ACF, it’s up to you to get it to work correctly in your template/theme. This is known as the “return value” in ACF.
<?php
$image = get_field('image'); // assigns the image field to the variable of $image
if( !empty($image) ){ ?> <!-- if the $image variable isn't empty, display the following: -->
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" /> <!--displays the URL for the image variable and also the alt tag which is entered in the WordPress media library-->
<?php }; ?> <!--ends the if statement -->
@aibrean
aibrean / asset-depot-carousel.php
Last active August 29, 2015 14:06
Asset Depot Plugin - Front-end display code.
@aibrean
aibrean / acf-radio-button-example.php
Last active August 29, 2015 14:06 — forked from emaildano/acf-radio-button-example.php
ACF radio button outputs
<?php $program = get_sub_field('program_selection'); ?>
<?php if( $program == 'intensity' ){ ?>
<?php } else if( $program == 'crossfit' ){ ?>
<?php } else if( $program == 'personal' ){ ?>
<?php } else if( $program == 'allprograms' ){ ?>
@aibrean
aibrean / css.css
Created September 9, 2014 20:25
Fork of Carousel Extended from Bootsnip to play nice with Bootstrap 3.2
.hide-bullets {
list-style:none;
margin-left: -40px;
margin-top:20px;
}
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">
<img alt="Brand" src="...">
</a>
</div>
</div>
</nav>
@aibrean
aibrean / blocklist
Last active August 29, 2015 14:09
Remove semalt and other bots from accessing your site - leads to false positive in Google Analytics
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http://.*backgroundpictures\.net/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*embedle\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*extener\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*fbfreegifts\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*feedouble\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*feedouble\.net/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*joinandplay\.me/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*joingames\.org/ [NC,OR]