Skip to content

Instantly share code, notes, and snippets.

View shaunkrd's full-sized avatar

Shaun Dobson shaunkrd

View GitHub Profile
@shaunkrd
shaunkrd / cloudSettings
Created August 8, 2018 14:27
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-08-08T14:27:18.981Z","extensionVersion":"v3.0.0"}
@shaunkrd
shaunkrd / keybase.md
Created January 15, 2018 10:43
Keybase verification

Keybase proof

I hereby claim:

  • I am shaunkrd on github.
  • I am shaunkrd (https://keybase.io/shaunkrd) on keybase.
  • I have a public key ASCv3ivGG5HV6jRIApAzxQfmgIMRgBSA8pc17aCO6ls5dwo

To claim this, I am signing this object:

@shaunkrd
shaunkrd / gist:c36b3e4b886d50a927c6b7f57a6ed21b
Created May 24, 2017 10:27
WordPress - Give editors access to 'Appearance' menu
// Give editors access to 'Appearance' menu
// get the the role object
$role_object = get_role( 'editor' );
// add $cap capability to this role object
$role_object->add_cap( 'edit_theme_options' );
@shaunkrd
shaunkrd / wp-archive-pagination-navigation.php
Created January 12, 2017 15:07
Add pagination navigation to WordPress posts archive
<?php
$pages_required = $wp_query->max_num_pages;
// If $paged = 0 make it 1 for display below
if ($paged == 0) $paged = 1;
if ( $pages_required > 1 ) :
?>
<nav class="pagination">
<?php echo previous_posts_link( 'Newer', $pages_required ); ?>
<span class="pagination-indicator">Page <?php echo $paged; ?> of <?php echo $pages_required; ?></span>
@shaunkrd
shaunkrd / wp-archive-date-filtering-display.php
Last active January 12, 2017 14:55
Show date filter used to access WordPress posts archive
<?php if (is_date()) : ?>
<?php
// get the date filter to display below
if ( is_day() ) $date_filter = get_the_date('F jS Y');
else if ( is_month() ) $date_filter = get_the_date('F Y');
else if ( is_year() ) $date_filter = get_the_date('Y');
?>
<p>Archive for: <?php echo $date_filter; ?></p>
<?php endif; // END if (is_date()) ?>
@shaunkrd
shaunkrd / Wordpress 'Howdy' admin message replacement
Created April 9, 2013 15:50
Wordpress replace the annoying 'Howdy' admin message
function replace_howdy( $wp_admin_bar ) {
$my_account=$wp_admin_bar->get_node('my-account');
$newtitle = str_replace( 'Howdy,', 'Logged in as', $my_account->title );
$wp_admin_bar->add_node( array(
'id' => 'my-account',
'title' => $newtitle,
) );
}
add_filter( 'admin_bar_menu', 'replace_howdy',25 );