Skip to content

Instantly share code, notes, and snippets.

Avatar

Brian Krogsgard krogsgard

View GitHub Profile
@krogsgard
krogsgard / wp-cli-delete-comments-from-specific-post.sh
Created Apr 12, 2017
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.
View wp-cli-delete-comments-from-specific-post.sh
wp comment delete $(wp comment list --post_id=123 --format=ids)
View roadmap.md

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 Sep 1, 2016
Add meta data for a CPT to the REST response. `wp-json/wp/v2/poststatus_partners?_embed`
View register_rest_fields.php
<?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 Feb 29, 2016
Having all plugins in Git is a pain. It makes life easier to manage just the plugins I personally maintain in Git.
View gitignore.txt
.DS_Store
node_modules
.sass-cache
uploads
debug.log
.css.map
themes/*
!themes/poststatus/
@krogsgard
krogsgard / rest-resources.txt
Last active Jan 13, 2016
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!
View rest-resources.txt
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 Jan 29, 2016
Stuff for wrangling Jetpack. End result is along these lines: https://cldup.com/8x050WNF_L.png
View template-file.php
<?php echo krogs_output_related_posts(); ?>
View get-cat-link.php
@krogsgard
krogsgard / except-sass.scss
Created Feb 24, 2014
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.
View except-sass.scss
.hentry.featured {
border-bottom: 15px solid #f6f6f6;
padding-bottom: 1em;
.singular & {
border-bottom: 0;
padding-bottom: 0;
}
}
View bbPress-user-profile-link-shortcode.php
@krogsgard
krogsgard / nav-styles.css
Last active Jun 11, 2019
_s theme navigation Javascript
View nav-styles.css
/* Small menu */
.menu-toggle {
display: none;
cursor: pointer;
}
@media screen and (max-width: 600px) {
.menu-toggle,
.main-navigation.toggled .nav-menu {
display: block;