Skip to content

Instantly share code, notes, and snippets.

View robskidmore's full-sized avatar

Rob Skidmore robskidmore

View GitHub Profile
@robskidmore
robskidmore / woocommerce-autocomplete-payment-gateway.php
Last active January 3, 2016 21:59
Autocomplete Woocommerce order based on payment gateway
<?php
// Update order status based on the id of payment gateway
function credit_card_complete_order_status( $order_id ) {
$order = new WC_Order( $order_id );
if ( $order->payment_method == 'authorize_net' ) {
$order->update_status('completed', 'Automatically Completed');
}
}
@robskidmore
robskidmore / print-taxonomies-by-post.php
Last active January 4, 2016 01:49
Print out current post taxonomies in an html comment
<?php
function get_current_post_taxonomies(){
global $post;
$taxonomy_names = get_object_taxonomies( $post );
?>
<!--<tt><pre><?php print_r( $taxonomy_names); ?></tt></pre>-->
<?php
}
@robskidmore
robskidmore / hover-and-replace-data-attributes.js
Created January 23, 2014 00:52
Hover and replace using data-attributes
jQuery(function($) {
$('.hover-image').bind('mouseover', function() {
$('.testimonial').html($(this).data('testimonial'));
});
});
@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;
}
@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;
}
<?php
// Trim a string by words instead of characters
$pos=strpos($content, ' ', 200);
substr($content,0,$pos );
@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,
.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;}
.entry ul {
list-style-type: square;
}
.entry li {
padding:6px 0;
color: #01518f;
}
.entry ol {
counter-reset:li;
margin-left:0;
@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');