Skip to content

Instantly share code, notes, and snippets.

View danieljwonder's full-sized avatar
💻

Daniel Wonder danieljwonder

💻
View GitHub Profile
@danieljwonder
danieljwonder / functions.php
Last active May 12, 2022 19:48
Enable excerpts for LearnDash Lessons
<?php
/**
* Enable excerpts for LearnDash Lessons
*/
function add_excerpts_to_ld_lessons() {
add_post_type_support( 'sfwd-lessons', 'excerpt' );
}
add_action( 'init', 'add_excerpts_to_ld_lessons' );
@danieljwonder
danieljwonder / functions.php
Created July 31, 2018 04:19
Disable Discourse account activation email for sites with WP Discourse SSO
<?php
/*
* Disable Discourse account activation email for sites with WP Discourse SSO
*/
add_filter( 'discourse_email_verification', 'wpdc_sso_disable_email_verification' );
function wpdc_sso_disable_email_verification() {
return false;
}
@danieljwonder
danieljwonder / functions.php
Created July 31, 2018 01:46
Add user to `Members` Discourse Group if active WooCommerce Memberships plan is found.
<?php
/**
* Add user to `Members` group if active WooCommerce Memberships plan is found.
*
* @params array $params wpdc sso data
* @return array $params wpdc sso data including `Members` group status
*/
function wpdc_wc_memberships_add_to_dc_group( $params ) {
// Bail if Memberships isn't active
@danieljwonder
danieljwonder / return-home.html
Created July 27, 2018 05:25
Add Homepage Icon to Discourse Menu
<!--
To add this JavaScript code to your site theme:
1. Go to Admin > Customize > Themes
2. Select the theme you wish to customize
5. Click `Edit CSS/HTML`
4. Go to `</head>` tab
5. Copy & paste code from below
6. Click to Preview/Save
</head>
-->
@danieljwonder
danieljwonder / functions.php
Created June 25, 2018 02:27 — forked from srikat/functions.php
Adding a cart icon with number of items and total cost in nav menu when using WooCommerce. http://sridharkatakam.com/adding-cart-icon-number-items-total-cost-nav-menu-using-woocommerce/
//* Make Font Awesome available
add_action( 'wp_enqueue_scripts', 'enqueue_font_awesome' );
function enqueue_font_awesome() {
wp_enqueue_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css' );
}
/**
* Place a cart icon with number of items and total cost in the menu bar.
@danieljwonder
danieljwonder / functions.php
Created June 22, 2018 02:21
Add List of WooCommcerce Product Tags to Genesis Sidebar
<?php
/* Add List of WooCommcerce Product Tags to Genesis Sidebar */
function wc_product_tag_list() {
$terms = get_terms(array('taxonomy' => 'product_tag', 'hide_empty' => false));
?>
<section id="woocommerce_product_tag_list" class="widget woocommerce widget_product_tag_list">
<div class="widget-wrap">
<h3 class="widgettitle widget-title">Product tags</h3>
<ul class="product-tags">
@danieljwonder
danieljwonder / functions.php
Last active November 17, 2022 14:36
Add LearnDash Enrolled Courses Grid to My Account Tab in WooCommerce
<?php
/* Add LearnDash Enrolled Courses Grid to My Account Tab in WooCommerce */
/* Add Courses Link to My Account menu */
add_filter ( 'woocommerce_account_menu_items', 'wc_ld_link', 40 );
function wc_ld_link( $menu_links ){
$menu_links = array_slice( $menu_links, 0, 5, true )
+ array( 'courses' => 'My Courses' )
+ array_slice( $menu_links, 5, NULL, true );
@danieljwonder
danieljwonder / wc-change-number-of-related-products.php
Created June 21, 2018 22:39 — forked from woogists/wc-change-number-of-related-products.php
[Theming Snippets] Change number of related products output
@danieljwonder
danieljwonder / disable-woocommerce-3-zoom.php
Created June 21, 2018 22:37 — forked from corsonr/disable-woocommerce-3-zoom.php
Disable WooCommerce Product Image Zoom
<?php
/* Disable WooCommerce Product Image Zoom */
add_action( 'after_setup_theme', function() {
remove_theme_support( 'wc-product-gallery-zoom' );
}, 20 );
@danieljwonder
danieljwonder / .htaccess
Created June 15, 2018 01:23
Block Referrer Spam
# BEGIN Block Referrer Spam
SetEnvIfNoCase Referer exampledomain.com spammer=yes
Order allow,deny
Allow from all
Deny from env=spammer
#END Block Referrer Spam