Skip to content

Instantly share code, notes, and snippets.

View krogsgard's full-sized avatar

Brian Krogsgard krogsgard

View GitHub Profile

This is where we'll collect all the things that need doing on Post Status, in terms of overall goals for improving things. It is not a specific issue tracker, though issues may be referenced from here.

Site goals

Improve user experience!

Checkout and My Account

  • Improve Checkout flow to require fewer and appropriate fields
  • Improve layout of cart/checkout
  • Ensure as much is being auto-filled as possible to reduce barrier for existing customers
@krogsgard
krogsgard / woo-loop-image-wrap.php
Created June 29, 2012 03:51
WooCommerce insert wrapper around thumbnail images in loop
<?php
/* This snippet removes the action that inserts thumbnails to products in teh loop
* and re-adds the function customized with our wrapper in it.
* It applies to all archives with products.
*
* @original plugin: WooCommerce
* @author of snippet: Brian Krogsard
*/
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10);
@krogsgard
krogsgard / list-terms-shortcode.php
Created June 24, 2012 23:23
shortcode list taxonomy terms
<?php
/**
* Displays a list of terms for a specific taxonomy.
* Based on Justin Tadlock's [entry-terms] shortcode
* Added attribute to not link to the taxonomy
* using wp_get_object_terms() to do so
*
* @author Brian Krogsgard
*
* @access public
@krogsgard
krogsgard / old-underscores-header-markup.php
Last active December 21, 2021 09:10
This is an example of the older small-menu handling with the part of the header and .js files for the _s theme that are relevant
<header id="masthead" class="site-header" role="banner">
<hgroup>
<h1 class="site-title"><a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
</hgroup>
<nav role="navigation" class="site-navigation main-navigation">
<h1 class="assistive-text"><?php _e( 'Menu', '_s' ); ?></h1>
<div class="assistive-text skip-link"><a href="#content" title="<?php esc_attr_e( 'Skip to content', '_s' ); ?>"><?php _e( 'Skip to content', '_s' ); ?></a></div>
@krogsgard
krogsgard / wp-query-the-right-way.php
Last active January 4, 2021 21:59
sample custom WP_Query the right way
<?php
/*
* WP_Query happy dance
*
* this is a sample WP_Query the right way
*/
$args = array (
'post_type' => 'post',
@krogsgard
krogsgard / custom-field-advanced-body-class.php
Created June 20, 2012 16:57
add a body class based on a post's custom field value
<?php
// check for '_my_custom_field' meta key on pages and page parents and add a body class if meta value equals 'some-value'
add_filter('body_class','krogs_custom_field_body_class');
function krogs_custom_field_body_class( $classes ) {
global $post;
@krogsgard
krogsgard / wp-trim-words-example
Created February 23, 2012 05:34
Example query using wp_trim_words()
<div class="info-box">
<?php $krogsquery = new WP_Query( array(
'post_type' => 'post',
'posts_per_page' => 3
)); ?>
<h3 class="info-headline">City News</h3>
<?php while($krogsquery->have_posts()) : $krogsquery->the_post(); ?>
@krogsgard
krogsgard / nav-styles.css
Last active June 11, 2019 17:45
_s theme navigation Javascript
/* Small menu */
.menu-toggle {
display: none;
cursor: pointer;
}
@media screen and (max-width: 600px) {
.menu-toggle,
.main-navigation.toggled .nav-menu {
display: block;
@krogsgard
krogsgard / wp-cli-delete-comments-from-specific-post.sh
Created April 12, 2017 17:01
This WP CLI command deletes all comments on a post with ID of "123". You can do other things, like add a "status=spam" or whatever to the comment list command as well.
wp comment delete $(wp comment list --post_id=123 --format=ids)
@krogsgard
krogsgard / sample-functions-child-theme.php
Last active November 2, 2018 19:50
jQuery for handling toggle functionality with wp_localize_script ( small_menu_vars.size ) and WordPress.
<?php
/**
* krogs_child_theme_new_menu_size function.
*
*/
add_filter( 'krogs_theme_small_menu_size', 'krogs_child_theme_new_menu_size' );
function krogs_child_theme_new_menu_size( $size ) {
$size = 450;