Skip to content

Instantly share code, notes, and snippets.

@deeman
deeman / functions.php
Last active October 5, 2019 13:39
Genesis Framework: Modify the Comments Headline Text
//* Modify comments title text "Comments" in comments*/
add_filter( 'genesis_title_comments', 'sp_genesis_title_comments' );
function sp_genesis_title_comments() {
$title = '<h3>Your custom title here</h3>';
return $title;
}
@deeman
deeman / functions.php
Created August 30, 2019 11:22
WooCommerce: Rename Tags
// Rename "Tags" in Single Product Page - WooCommerce
add_filter('gettext', 'woo_translate_tag_taxonomy');
add_filter( 'ngettext', 'woo_translate_tag_taxonomy' );
function woo_translate_tag_taxonomy($translated) {
if ( is_product() ) {
// This will only trigger on the single product page
$translated = str_ireplace('tag', 'brand', $translated);
}
@deeman
deeman / style.css
Created September 10, 2019 10:53
Genesis Framework: Logo Before Site Title
/* Ex.: Iconlogo */
.site-title a::before {
background-image: url(url-to-your-logo.png);
background-size: 46px 26px;
background-repeat: no-repeat;
display: inline-block;
width: 36px;
height: 36px;
content: "";
@deeman
deeman / functions.php
Created September 10, 2019 13:55
WooCommerce: Notify admin when new customer account is created
/**
* Code goes in your Child Theme functions.php.
*/
add_action( 'woocommerce_created_customer', 'woocommerce_created_customer_admin_notification' );
function woocommerce_created_customer_admin_notification( $customer_id ) {
wp_send_new_user_notifications( $customer_id, 'admin' ); }
@deeman
deeman / functions.php
Last active September 11, 2019 07:39
WooCommerce: Remove or Rename WooCommerce Tabs
/*
//REMOVE
add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );
function woo_remove_product_tabs( $tabs ) {
unset( $tabs['description'] ); // Remove the description tab
unset( $tabs['reviews'] ); // Remove the reviews tab
unset( $tabs['additional_information'] ); // Remove the additional information tab
return $tabs;
}
@deeman
deeman / functions.php
Created September 23, 2019 06:57
WordPress Admin - Apply Custom CSS To Admin Area
add_action('admin_head', 'my_custom_fonts');
function my_custom_fonts() {
echo '<style>
body, td, textarea, input, select {
font-family: "Lucida Grande";
font-size: 12px;
}
</style>';
}
@deeman
deeman / functions.php
Created September 23, 2019 07:02
WordPress - Get Featured Image URL
// Post thumbnails are pretty useful and pretty easy to use in WordPress. Simply add:
add_theme_support('post-thumbnails');
// To a theme's functions.php file and you'll get a Featured Image module on the admin screen for posts
// which allows you to select one.
// It is also very easy to output that image as an HTML <img>:
the_post_thumbnail();
//Get the URL?
@deeman
deeman / functions.php
Created September 23, 2019 11:12
WordPress - Remove Admins Dashboard Widgets
/*REMOVE ADMIN DASHBOARD WIDGETS*/
function remove_dashboard_widgets() {
global $wp_meta_boxes;
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_drafts']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);
@deeman
deeman / functions.php
Created September 23, 2019 11:18
WordPress - Remove Help-tab In Admin Area
// Remove 'help'-tab i Admin area
add_filter('contextual_help_list','contextual_help_list_remove');
function contextual_help_list_remove(){
global $current_screen;
$current_screen->remove_help_tabs();
}
@deeman
deeman / function-popular-post-template.php
Last active September 29, 2019 11:30
WordPress: Show most popular posts without a plugin
//Add this anywhere in your template where you wish to display the posts.
<?php
$popular_posts_args = array(
'posts_per_page' => 3,
'meta_key' => 'my_post_viewed',
'orderby' => 'meta_value_num',
'order'=> 'DESC'
);