This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add an order meta field for "Refund Reason" so admin can track | |
* why people are asking for a refund. | |
*/ | |
function my_pmpro_refund_reason_after_order_settings( $order ) { | |
if ( empty( $order->id ) ) { | |
// This is a new order. | |
return; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Filter to use the Basic User Avatar on the BuddyPress Profile. | |
*/ | |
function my_bua_bp_avatar( $image, $params ) { | |
// Determine if user has a local avatar | |
$local_avatar = get_user_meta( $params['item_id'], 'basic_user_avatar', true ); | |
if ( empty( $local_avatar ) ) { | |
return $image; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Filter to show WordPress Toolbar for Editor Role using the | |
* Hide Admin Bar From Non-Admins plugin. | |
* https://wordpress.org/plugins/hide-admin-bar-from-non-admins/ | |
* | |
*/ | |
function my_habfna_show_admin_bar_roles( $habfna_show_admin_bar_roles ) { | |
$habfna_show_admin_bar_roles[] = 'editor'; | |
return $habfna_show_admin_bar_roles; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Fallback to add GTM to body of page. | |
* | |
*/ | |
function pmpro_add_google_tag_manager_to_body() { | |
// Don't track admins. | |
if ( current_user_can( 'manage_options' ) ) { | |
return; | |
} ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add a session variable so we only push the ecommerce data to GTM on the first checkout. | |
* Not any subsequent visit to the confirmation page. | |
* | |
*/ | |
function pmpro_gtag_ecommerce_set_session( $user_id, $morder ) { | |
pmpro_set_session_var( 'pmpro_gtag_order', $morder->id ); | |
} | |
add_action( 'pmpro_after_checkout', 'pmpro_gtag_ecommerce_set_session', 10, 2 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Builds the dataLayer and loads GTM tracking in the head. | |
* Includes Custom Dimensions and Ecommerce data. | |
* | |
*/ | |
function pmpro_add_google_tag_manager_to_head() { | |
global $pmpro_pages; | |
// Don't track admins. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Hide tags from display if there is only one post in the taxonomy. | |
* | |
*/ | |
function my_get_the_terms( $terms, $post_id, $taxonomy ) { | |
if ( $taxonomy === 'post_tag' ) { | |
foreach( $terms as $key => $term ) { | |
if ( $term->count < 2 ) { | |
unset( $terms[ $key ] ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[membership level="0"] | |
Are you interested in learning what the meaning of life is? | |
Sign up today and we'll tell you! | |
[/membership] | |
[membership level="1"] | |
Thanks for being a member of our program. | |
The meaning of life is: 42. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
h1, | |
h2, | |
.h1, | |
.h2 { | |
font-size: 3.2rem; | |
line-height: 4.4rem; | |
} | |
.entry-content h1, | |
.entry-content .h1 { | |
font-size: 4.7rem; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Use this recipe in conjunction with PMPro bbPress Add On to show the expiration date on single forum user profile. | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* | |
*/ | |
function my_bbp_template_before_user_profile_pmpro_expiration_date() { | |
$user_id = bbp_get_user_id( 0, true, false ); |