Skip to content

Instantly share code, notes, and snippets.

@gstricklind
gstricklind / MemberPress: Sub Account Tab
Last active July 18, 2023 12:12
Memberpress Corporate Addon: this function creates a new tab on the Account page called "Sub Accounts" so your subscribers can easily find and access where to create their sub accounts. Paste this function into your theme's functions.php file
/* ==========================================================================
Memberpress: Add a Sub Account Tab to the Account page
========================================================================== */
function gs_mepr_add_some_tabs($user) {
$sub_accounts_active = (isset($_GET['action']) && $_GET['action'] == 'manage_sub_accounts')?'mepr-active-nav-tab':'';
$transactions = $user->active_product_subscriptions('transactions');
@gstricklind
gstricklind / MemberPress: Sub Account Shortcode
Created April 6, 2021 03:32
A function to create a "Manage sub accounts" link for Memberpress Corporate Account addon - add this to your theme's functions.php file
/* ==========================================================================
Corporate Account: Sub Account Shortcode Link
========================================================================== */
//[manage_sub_accounts]
// Based off of: https://gist.github.com/cartpauj/e8299ab1f73257b9512b8a21c07462b4
add_shortcode( 'manage_sub_accounts', 'gs_manage_sub_accounts');
function gs_manage_sub_accounts(){
$user = MeprUtils::get_currentuserinfo();
if($user !== false) {
@gstricklind
gstricklind / custom.js
Last active March 9, 2019 20:51
Add Write A Review link to woocommerce product pages
//https://ginastricklind.com/how-to-add-write-your-review-link-to-woocommerce-product-page/
(function($){
$('.woocommerce-product-rating .woocommerce-review-link').after(' | <a class="write-your-review" href="#tab-reviews">Write Your Review</a>');
$('.write-your-review').click( function () {
$('.tabs li').removeClass('active');
$('.woocommerce-Tabs-panel').attr("style", "display:none");
@gstricklind
gstricklind / functions.php
Last active March 9, 2019 19:55
Product Reviews Shortcode - only works on single-product template
/*========================================================================
3 Column Reviews shortcode - can only be used on single product pages
https://ginastricklind.com/how-to-create-a-product-reviews-shortcode-query/
========================================================================*/
add_shortcode( 'display_latest_reviews', 'gs_display_latest_reviews' );
function gs_display_latest_reviews() {
if( is_product() ) {
global $product;
$id = $product->id;
@gstricklind
gstricklind / front-page.php
Last active March 5, 2019 02:16
Genesis Front Page Custom Loop Fix
<?php
add_action( 'genesis_after_entry', 'homepage_post_loop' );
function homepage_post_loop() {
global $wp_query;
global $paged;
$paged = get_query_var('page');
$args = array(
'posts_per_page' => 10,
@gstricklind
gstricklind / content-product.php
Last active February 24, 2019 04:26
The Content File to Add Beaver Builder Editable Content to Single Product Pages
<?php
////https://ginastricklind.com/make-beaver-builder-work-on-woocommerce-product-pages/
do_action( 'fl_before_post' ); ?>
<?php do_action( 'fl_before_post_content' ); ?>
<div class="fl-post-content clearfix" itemprop="text">
<?php
the_content();
?>
</div><!-- .fl-post-content -->
@gstricklind
gstricklind / single-product.php
Last active February 24, 2019 04:25
Adds Beaver Builder To The Bottom of Product Pages using get_template_part( 'content', 'product' )
<?php
//https://ginastricklind.com/make-beaver-builder-work-on-woocommerce-product-pages/
/**
* The Template for displaying all single products
*
* This template can be overridden by copying it to yourtheme/woocommerce/single-product.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
@gstricklind
gstricklind / functions.php
Last active February 18, 2018 20:29
Remove tag cloud limit
add_filter('widget_tag_cloud_args', 'gs_filter_tag_cloud_limit');
function gs_filter_tag_cloud_limit($args){
//Optionally change the taxonomy
//if(isset($args['taxonomy']) && $args['taxonomy'] == 'post_tag'){
$args['number'] = ''; //Restrict number of tags
//}
return $args;
}
@gstricklind
gstricklind / puzzle-single.php
Created February 18, 2018 19:56
Open ALL links in new tab for a custom post type or page template type
// use this code in your page template where needed
function gs_target_blank($content) {
$post_string = $content;
$post_string = str_replace('<a', '<a target="_blank"', $post_string);
return $post_string;
}
add_filter( 'the_content', 'gs_target_blank' );
@gstricklind
gstricklind / style.css
Created July 14, 2017 18:57
Change Beaver Build Icon style +remove icon background
/* change social icons */
.fl-social-icons .fa-stack i:first-child {
display: none;
}
.fl-social-icons .fa-stack i:nth-child(2) {
color: inherit;
}