Skip to content

Instantly share code, notes, and snippets.

View bjonesy's full-sized avatar

Brandon Jones bjonesy

View GitHub Profile
@bjonesy
bjonesy / markdown-details-collapsible.md
Created August 29, 2023 17:54 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@bjonesy
bjonesy / remove-uncategorized.php
Created January 5, 2015 22:26
Filter out the uncategorized category from an array
<?php
/**
* Filter out the uncategorized category from an array
*/
function theme_slug_remove_uncategorized( $categories ) {
return array_filter( $categories, function( $c ) {
return $c->name != 'Uncategorized';
} );
}
@bjonesy
bjonesy / get-post-meta.php
Last active June 4, 2018 12:30
Better ways to retrieve custom fields get_post_meta()
<?php
/**
* Retrieve a single value of a custom field
*
* A wrapper for get_post_meta to make it so the $post_id is not required.
*
* @param unknown $key string - the custom field key
* @param unknown $p_id int (optional) - the post ID for post to retrieve the value from, defaults to current post
*/
@bjonesy
bjonesy / jetpack-publicize-custom-twitter-message.php
Created January 5, 2015 18:33
Customizing Publicize Sharing Behavior
<?php
/**
* Include WP Codebird
*
* Either in functions.php file or however you prefer to include it
*/
/* If on WordPress VIP */
// Load VIP Plugins/Lib