Skip to content

Instantly share code, notes, and snippets.

View krogsgard's full-sized avatar

Brian Krogsgard krogsgard

View GitHub Profile
krogsgard /
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)

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 / register_rest_fields.php
Last active September 1, 2016 22:01
Add meta data for a CPT to the REST response. `wp-json/wp/v2/poststatus_partners?_embed`
add_action( 'rest_api_init', function() {
array( 'poststatus_partners' ),
'get_callback' => 'poststatus_get_restable_field_values_for_partner_meta',
'update_callback' => 'poststatus_update_restable_field_values_for_partner_meta',
'schema' => null,
krogsgard / gitignore.txt
Created February 29, 2016 20:10
Having all plugins in Git is a pain. It makes life easier to manage just the plugins I personally maintain in Git.
krogsgard / rest-resources.txt
Last active January 13, 2016 14:10
I'll work to collect and add to this. Might be good stuff for :) I've covered loads of REST API stuff in my newsletter (, but don't have a definitive list anywhere that's more evergreen. Let's do that!
Basic docs:
Extending (includes philosophy):
Scott Bolinger has good posts:
And (mostly corresponding) gists:
Good series:
Nice eBook intro:
krogsgard / template-file.php
Last active January 29, 2016 17:21
Stuff for wrangling Jetpack. End result is along these lines:
<?php echo krogs_output_related_posts(); ?>
krogsgard / except-sass.scss
Created February 24, 2014 17:50
Is this the best way to do a "apply this except for this parent class" in Sass? Still required declaring twice, though the parent selector targeting thingy is really cool.
.hentry.featured {
border-bottom: 15px solid #f6f6f6;
padding-bottom: 1em;
.singular & {
border-bottom: 0;
padding-bottom: 0;
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) {
.main-navigation.toggled .nav-menu {
display: block;