Skip to content

Instantly share code, notes, and snippets.

View robskidmore's full-sized avatar

Rob Skidmore robskidmore

View GitHub Profile
@robskidmore
robskidmore / wordpress-test-post-type.php
Created November 7, 2014 15:51
Wordpress test post type
if('book'==get_post_type()) {
}
@robskidmore
robskidmore / wp-using-media-uploader.php
Created October 20, 2014 17:13
Using the Media uploader in wordpress make sure to include wp_enqueue_media();
(function($){
var frame;
$(function(){
$('#cloner-csv-button').click(function () {
// var $el =$(this);
if(frame) {
frame.open();
return;
@robskidmore
robskidmore / is-page-or-child-of.php
Created October 9, 2014 03:36
Test if is page or child of page Wordpress
function is_tree($pid) {
global $post;
if(is_page()&&($post->post_parent==$pid||is_page($pid))) {
return true;
} else {
return false;
}
};
@robskidmore
robskidmore / acf-add-options-page.php
Last active August 29, 2015 14:01
Advanced Custom Fields Add Options Page
// Custom ACF options pages
function my_acf_options_page_settings( $settings )
{
$settings['title'] = 'Site Options';
$settings['pages'] = array('Home', 'Highlighted');
return $settings;
}
add_filter('acf/options_page/settings', 'my_acf_options_page_settings');
.entry ul {
list-style-type: square;
}
.entry li {
padding:6px 0;
color: #01518f;
}
.entry ol {
counter-reset:li;
margin-left:0;
.entry table{border-collapse:collapse;margin:40px 0;font-family:'Linden Hill';font-size:18px;}
.entry th{font-size: 24px; font-weight: normal;padding-bottom: 10px;text-align:left;padding-left:20px;}
.entry td{padding:10px 30px;}
.entry td:last-child{border-right:none;}
.entry tbody {
border-top: 1px solid #DFDFDF;
border-bottom: 1px solid #DFDFDF;
}
.entry tbody tr:nth-child(odd) .row-one{background-color:#AEBBCE; color:#fff;}
.entry tbody tr:nth-child(odd) .row-two{background-color:#fff;color:#381d7a;}
@robskidmore
robskidmore / column-classes.css
Last active August 29, 2015 14:01
Column Classes
/* Column Classes
Link: http://twitter.github.io/bootstrap/assets/css/bootstrap-responsive.css
--------------------------------------------- */
.five-sixths,
.four-sixths,
.one-fourth,
.one-half,
.one-sixth,
.one-third,
<?php
// Trim a string by words instead of characters
$pos=strpos($content, ' ', 200);
substr($content,0,$pos );
@robskidmore
robskidmore / vertically-align-in-div.scss
Created May 9, 2014 17:11
Vertically align content in div
.container {
&:before {
content: '';
display: inline-block;
height: 100%;
vertical-align: middle;
}
.centered {
vertical-align: middle;
}
@robskidmore
robskidmore / body-class-custom-taxonomy-term.php
Last active August 29, 2015 13:55
Add body class based on custom taxonomy term
<?php
function add_taxonomy_term_as_body_classes( $classes ) {
global $post;
$terms = wp_get_post_terms($post->ID, '[taxonomy]', array("fields" => "all"));
foreach ($terms as $class ) {
$classes[] = $class->slug;
}
return $classes;
}