Skip to content

Instantly share code, notes, and snippets.

View krogsgard's full-sized avatar

Brian Krogsgard krogsgard

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

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 / 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`
<?php
add_action( 'rest_api_init', function() {
register_rest_field(
array( 'poststatus_partners' ),
'partner_meta',
array(
'get_callback' => 'poststatus_get_restable_field_values_for_partner_meta',
'update_callback' => 'poststatus_update_restable_field_values_for_partner_meta',
'schema' => null,
@krogsgard
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.
.DS_Store
node_modules
.sass-cache
uploads
debug.log
.css.map
themes/*
!themes/poststatus/
@krogsgard
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 javascriptdeeply.com :) I've covered loads of REST API stuff in my newsletter (poststatus.com/club), but don't have a definitive list anywhere that's more evergreen. Let's do that!
Basic docs: http://v2.wp-api.org/
Extending (includes philosophy): http://v2.wp-api.org/extending/adding/
Scott Bolinger has good posts: http://scottbolinger.com/category/wp-api/
And (mostly corresponding) gists: https://gist.github.com/scottopolis/
Good series: https://deliciousbrains.com/tag/wp-rest-api/
Nice eBook intro: https://wpengine.com/blog/wordpress-rest-api-free-ebook/
@krogsgard
krogsgard / template-file.php
Last active January 29, 2016 17:21
Stuff for wrangling Jetpack. End result is along these lines: https://cldup.com/8x050WNF_L.png
<?php echo krogs_output_related_posts(); ?>
@krogsgard
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
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;