Skip to content

Instantly share code, notes, and snippets.

View mikeoberdick's full-sized avatar

Mike Oberdick mikeoberdick

View GitHub Profile
@mikeoberdick
mikeoberdick / build_your_firm_blogs.php
Last active June 13, 2017 17:51
Build Your Firm Blog Function Adds
//* Remove the site description
remove_action( 'genesis_site_description', 'genesis_seo_site_description' );
//* Custom Footer
remove_action( 'genesis_footer', 'genesis_do_footer' );
add_action( 'genesis_footer', 'd4tw_custom_footer' );
function d4tw_custom_footer() {
?>
<p>Copyright &copy; <?php the_date('Y') ?> &middot; <a href = "<?php echo site_url(); ?>"><?php echo site_url(); ?></a></p>
<?php
@mikeoberdick
mikeoberdick / rows_in_the_loop.php
Created February 16, 2017 11:48
Snippet for adding new bootstrap rows in the loop
<?php
// check if the repeater field has rows of data
if( have_rows('staff_member') ):
$i = 0;
// loop through the rows of data
while ( have_rows('staff_member') ) : the_row(); ?>
@mikeoberdick
mikeoberdick / cpt_query.php
Created May 17, 2017 16:55
Custom Post Type Query with Pagination
<?php
if ( get_query_var('paged') ) {
$paged = get_query_var('paged');
} elseif ( get_query_var('page') ) { // 'page' is used instead of 'paged' on Static Front Page
$paged = get_query_var('page');
} else {
$paged = 1;
}
$custom_query_args = array(
@mikeoberdick
mikeoberdick / tax-terms.php
Created August 1, 2017 17:50
Show All Custom Post Type Taxonomy Terms
<?php
$taxonomy = 'portfolio_categories';
$terms = get_terms($taxonomy); // Get all terms of a taxonomy
if ( $terms && !is_wp_error( $terms ) ) :
?>
<ul>
<?php foreach ( $terms as $term ) { ?>
<li><a href="<?php echo get_term_link($term->slug, $taxonomy); ?>"><?php echo $term->name; ?></a></li>
@mikeoberdick
mikeoberdick / show-tax-terms-for-cpt.php
Last active August 1, 2017 17:51
Show Tax Terms for Single CPT
<?php $taxonomy = 'project-industry';
$terms = get_terms($taxonomy); // Get all terms for the taxonomy ?>
<?php foreach ( $terms as $term ) { ?>
<button type="button" data-filter="<?php echo $term->name; ?>"><?php echo $term->name; ?></button>
<?php } ?>
@mikeoberdick
mikeoberdick / php2javascript.php
Created April 1, 2018 00:55
PHP to Javascript Variable and Log to Console
<script>
var val = " <?php echo $postCount ?>"
console.log( val );
</script>
@mikeoberdick
mikeoberdick / sag.css
Created August 8, 2018 12:18
Spectrum Art Gallery Responsive WooCommerce Products
/* Designs 4 The Web */
/* Single Column Products */
@media screen and (max-width : 636px) {
.woocommerce ul.products[class*=columns-] li.product, .woocommerce-page ul.products[class*=columns-] li.product {
width: 100%;
}
}
/* Two Column Products */
@mikeoberdick
mikeoberdick / HTML Email
Created November 15, 2018 18:48
HTML Email
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width"><title>KnockMedia | Days of Summer Contest: Day 5</title></head><body style="-moz-box-sizing:border-box;-ms-text-size-adjust:100%;-webkit-box-sizing:border-box;-webkit-text-size-adjust:100%;Margin:0;box-sizing:border-box;color:#0a0a0a;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:1.3;margin:0;min-width:100%;padding:0;text-align:left;width:100%!important"><style type="text/css">@media only screen{html{min-height:100%;background:#f3f3f3}}@media only screen and (max-width:596px){.small-float-center{margin:0 auto!important;float:none!important;text-align:center!important}.small-text-center{text-align:center!important}.small-text-left{text-align:left!important}.small-text-right{text-align:right!important}}@m
@mikeoberdick
mikeoberdick / functions.php
Created March 19, 2019 23:56 — forked from srikat/functions.php
Changing the posts per page on first page without breaking pagination in WordPress. https://sridharkatakam.com/changing-posts-per-page-first-page-without-breaking-pagination-wordpress/
add_action( 'pre_get_posts', 'sk_query_offset', 1 );
function sk_query_offset( &$query ) {
// Before anything else, make sure this is the right query...
if ( ! ( $query->is_home() || is_main_query() ) ) {
return;
}
// First, define your desired offset...
$offset = -1;
@mikeoberdick
mikeoberdick / dropdown-filter-ajax.php
Created June 5, 2019 00:55
Creates a drop down that can be used to filter posts per page
$('#tax-filter').change(function() {
var filter = $('#tax-filter');
$.ajax({
url:filter.attr('action'),
data:filter.serialize(),
type:filter.attr('method'),
beforeSend:function(xhr){
$('#spinner').toggle();
},
success:function(data){