Skip to content

Instantly share code, notes, and snippets.

View hlashbrooke's full-sized avatar
🎲

Hugh Lashbrooke hlashbrooke

🎲
View GitHub Profile
@hlashbrooke
hlashbrooke / functions.php
Last active February 16, 2020 00:04
Seriously Simple Podcasting: Modify podcast feed slug
add_filter( 'ssp_feed_slug', 'ssp_modify_podcast_feed_slug' );
function ssp_modify_podcast_feed_slug ( $slug ) {
return 'new-slug';
}
@hlashbrooke
hlashbrooke / functions.php
Last active January 21, 2023 11:13
Seriously Simple Podcasting: Modify podcast archive slug
add_filter( 'ssp_archive_slug', 'ssp_modify_podcast_archive_slug' );
function ssp_modify_podcast_archive_slug ( $slug ) {
return 'new-slug';
}
@hlashbrooke
hlashbrooke / style.css
Last active August 29, 2015 14:10
Improved content image display for Twenty Fifteen
.entry-content img {
box-shadow: 0px 0 15px 5px #ccc;
}
.entry-content .wp-caption-text {
text-align: center;
}
@hlashbrooke
hlashbrooke / function.php
Created October 16, 2014 12:23
PHP: Loop through each character in a string
<?php
$str = "String to loop through"
$strlen = strlen( $str );
for( $i = 0; $i <= $strlen; $i++ ) {
$char = substr( $str, $i, 1 );
// $char contains the current character, so do your processing here
}
?>
@hlashbrooke
hlashbrooke / function1.php
Created October 16, 2014 12:21
Create a shortcode in WordPress
<?php
function shortcode_function( $params ) {
return "Shortcode content";
}
add_shortcode( 'shortcode_name', 'shortcode_function' );
?>
@hlashbrooke
hlashbrooke / die.php
Created October 16, 2014 12:11
WordPress debugging tips
<?php
die();
?>
@hlashbrooke
hlashbrooke / admin.css
Created October 16, 2014 11:35
Better bbPress admin icons
body #menu-posts-forum div.wp-menu-image:before {
content: "\f325" !important;
}
body #menu-posts-topic div.wp-menu-image:before {
content: "\f348" !important;
}
body #menu-posts-reply div.wp-menu-image:before {
content: "\f125" !important;
}
@hlashbrooke
hlashbrooke / functions.php
Created August 1, 2014 07:33
Sensei: Give editors access to all courses & lessons on the frontend
<?php
add_filter( 'sensei_all_access', 'sensei_editor_access' );
function sensei_editor_access( $access ) {
if( current_user_can( 'editor' ) ) {
$access = true;
}
return $access;
}
?>
@hlashbrooke
hlashbrooke / functions.php
Created August 1, 2014 07:20
Sensei: Force lesson ordering to use the menu order attribute instead of the custom ordering available from v1.6
<?php
add_filter( 'pre_get_posts', 'sensei_lessons_use_menu_order' );
function sensei_lessons_use_menu_order( $query ) {
if( is_admin() || 'lesson' != $query->query_vars['post_type'] ) {
return;
}
$query->set( 'orderby', 'menu_order date' );
}
@hlashbrooke
hlashbrooke / functions.php
Last active January 4, 2016 04:24
WooCommerce Order Barcodes: Modify scan permissions
<?php
add_filter( 'woocommerce_order_barcodes_scan_permission', 'modify_woocommerce_order_barcodes_scan_permission' );
function modify_woocommerce_order_barcodes_scan_permission( $has_permission ) {
// Do any required permission checks here
$has_permission = true;
return $has_permission;
}
?>