Skip to content

Instantly share code, notes, and snippets.

View adambradford's full-sized avatar

Adam Bradford adambradford

View GitHub Profile
/**
* This function adds a custom select field to the campaign submission form.
*
* @param array $fields
* @param Charitable_Ambassadors_Campaign_Form $form
* @return array
*/
function ed_charitable_add_campaign_form_select_field( $fields, $form ) {
/**
@adambradford
adambradford / style.css
Last active February 8, 2022 09:08
Halftone overlay effect for background images in CSS
.container {
background: url('path/to/background.jpg');
background-size: cover;
background-repeat: no-repeat;
position: relative; /* use this if optional inner container is used */
}
.container:after {
background-image: linear-gradient(45deg, #666 25%, transparent 25%),
linear-gradient(-45deg, #666 25%, transparent 25%),
@adambradford
adambradford / functions.php
Created April 17, 2018 20:28
Replace the ‘Sorry, no content matched your criteria’ message in a WordPress site built with the Genesis Framework
<?php
//* Add this to your functions.php file. Do NOT include the opening php tag
//* Replace the ‘Sorry, no content matched your criteria’ message
add_filter( 'genesis_noposts_text', 'ab_change_search_text_two', 10, 2 );
function ab_change_search_text_two( $text ) {
$text = __( 'Replace this with your own text');
return $text;
}
@adambradford
adambradford / functions.php
Last active April 27, 2018 19:09
Hide the WordPress admin bar from Subscribers or any logged in user who can't edit posts
<?php
//* Add this to your functions.php file. Do NOT include the opening php tag
//* Hide the admin bar from anyone who can't edit posts
add_action('set_current_user', 'ab_hide_admin_bar');
function ab_hide_admin_bar() {
if (!current_user_can('edit_posts')) {
show_admin_bar(false);
}
}
@adambradford
adambradford / functions.php
Last active April 13, 2018 13:54
Customise the ‘read more’ text in a WordPress site built with the Genesis Framework
<?php
//* Add this to your functions.php file. Do NOT include the opening php tag
//* Customise the 'read more' text
add_filter( 'excerpt_more', 'genesis_read_more_link' );
add_filter( 'get_the_content_more_link', 'genesis_read_more_link' );
add_filter( 'the_content_more_link', 'genesis_read_more_link' );
function genesis_read_more_link() {
return '<a class="more-link" href="' . get_permalink() . '">[Read more...]</a>';
}
@adambradford
adambradford / functions.php
Created March 30, 2018 14:02
Remove the 'Downloads' link from My Account page in WooCommerce
<?php
//* Add this to your functions.php file. Do NOT include the opening php tag
// Remove the 'Downloads' link from My Account page in WooCommerce
add_filter( 'woocommerce_account_menu_items', 'custom_woocommerce_account_menu_items' );
function custom_woocommerce_account_menu_items( $items ) {
if ( isset( $items['downloads'] ) ) unset( $items['downloads'] );
return $items;
}
@adambradford
adambradford / wp-config.php
Created March 25, 2018 19:39
Place Jetpack in Development Mode in a WordPress site
<?php
//* Add this to your wp-config.php file, before the /* That's all, stop editing! Happy blogging. */ line.
//* Do NOT include the opening php tag
//* Place Jetpack in Development Mode
define( 'JETPACK_DEV_DEBUG', true);
@adambradford
adambradford / functions.php
Created March 25, 2018 18:57
Change the Entry Meta wording on a WordPress site built with the Genesis framework
<?php
//* Add this to your functions.php file. Do NOT include the opening php tag
//* Customise the Entry Meta wording
add_filter( 'genesis_post_meta', 'ab_entry_meta_footer' );
function ab_entry_meta_footer( $post_meta ) {
$post_meta = '[post_categories before="Filed under: "] [post_tags before="Tagged with: "]';
return $post_meta;
}
@adambradford
adambradford / after-footer.php
Created March 24, 2018 07:45
Example content for an After Footer area in a WordPress site built with the Genesis Framework
@adambradford
adambradford / functions.php
Last active March 25, 2018 19:17
Customise the 'Howdy/Hi' message in the WordPress toolbar
<?php
//* Add this to your functions.php file. Do NOT include the opening php tag
//* Customise the 'Howdy/Hi' message in the toolbar
function howdy_message($translated_text, $text, $domain) {
$new_message = str_replace('Howdy', 'Welcome', $text);
return $new_message;
}
add_filter('gettext', 'howdy_message', 10, 3);