This file contains 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
// https://docs.apppresser.com/article/515-interstitial-ads | |
(function() { | |
// show an interstitial when an element with an id of showAd is clicked. For example, add this to your app: | |
// <button ion-item id="showAd" (click)="pushPage( pages.tab_menu.items[1] )"><ion-icon name="cog" item-left></ion-icon>Show ad and navigate</button> | |
// you can use any element with the id of showAd, it doesn't have to be a button | |
// you can also load the interstitial when the app loads by moving it outside the ready function | |
ready("#showAd", function(element) { | |
var el = document.getElementById("showAd"); |
This file contains 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 groups to member list | |
// add this code to a custom plugin | |
function app_extend_bp_member($response, $request, $user) { | |
$joined_groups = array(); | |
$group_ids = groups_get_user_groups($user->ID); | |
foreach($group_ids['groups'] as $id) { | |
$current_group = groups_get_group(array('group_id' => $id)); | |
if($current_group->name !== 'hidden') { | |
$joined_groups[] = $current_group->name; |
This file contains 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 this code to a custom plugin on your site to add customer emails to your abandoned checkout flow | |
// Requires the free plugin code here: https://hollerwp.com/woo-checkout-save-email/ | |
// You need to install this first: composer require drewm/mailchimp-api | |
// see https://github.com/drewm/mailchimp-api | |
use \DrewM\MailChimp\MailChimp; | |
$MailChimp = new MailChimp('abc123abc123abc123abc123abc123-us1'); // change this to your MC API key | |
// this action fires when a new email is added to your checkout |
This file contains 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 | |
// make email the first field on the WooCommerce checkout page | |
add_filter( 'woocommerce_checkout_fields', 'sb_edit_checkout_fields' ); | |
function sb_edit_checkout_fields( $fields ) { | |
// make email first | |
$fields['billing']['billing_email']['priority'] = 4; | |
return $fields; |
This file contains 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 | |
// put this code in your theme functions.php or a custom plugin | |
add_filter( 'woocommerce_checkout_fields' , 'sb_remove_woo_checkout_fields' ); | |
function sb_remove_woo_checkout_fields( $fields ) { | |
// remove some billing fields | |
unset($fields['billing']['billing_company']); | |
unset($fields['billing']['billing_address_2']); |
This file contains 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 this code to a theme functions.php or custom plugin | |
add_filter( 'woocommerce_checkout_fields' , 'sb_override_checkout_fields' ); | |
// Our hooked in function - $fields is passed via the filter! | |
function sb_override_checkout_fields( $fields ) { | |
$fields['shipping']['shipping_phone'] = array( | |
'label' => __('Phone', 'woocommerce'), | |
'placeholder'=> _x('Phone', 'placeholder', 'woocommerce'), |
This file contains 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 | |
// Support Variation Swatches for WooCommerce plugin in AppPresser | |
// put this code in a custom plugin | |
add_filter( 'appcommerce_attribute_terms', function( $terms ) { | |
foreach( $terms as $key => $option) : | |
// if you have a different plugin, just replace 'product_attribute_color' with the key from your plugin | |
$terms[$key]->attribute_color = get_term_meta( $option->term_id, 'product_attribute_color', 1 ); | |
$terms[$key]->attribute_image = wp_get_attachment_url( get_term_meta( $option->term_id, 'product_attribute_image', 1 ) ); | |
endforeach; |
This file contains 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 this code to a custom plugin | |
add_filter('bp_rest_members_get_items_query_args', function( $args, $request ) { | |
// These are just examples. Find available arguments here: https://codex.buddypress.org/developer/bp_user_query/ | |
$args['search_terms'] = 'football'; | |
$args['exclude'] = '1,2,3'; | |
return $args; |
This file contains 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 this code to a custom plugin | |
add_filter('appcommunity_prepare_user', function( $data, $request ) { | |
// $data['id'] is the user_id. With that, you can look up user meta like this | |
// $data['appp']['below_content'] = '<p>Welcome back ' . get_user_meta( $data['id'], 'nickname', 1 ) . '!</p>'; | |
// you can also show xprofile fields like this | |
$data['appp']['user_actions'] = '<div class="custom-profile-fields"><p><strong>' . xprofile_get_field( 1, $data['id'] )->name . '</strong><br/>' . xprofile_get_field_data( 1, $data['id'] ) . '</p><p><strong>' . xprofile_get_field( 2, $data['id'] )->name . '</strong><br/>' . xprofile_get_field_data( 2, $data['id'] ) . '</p></div>'; |
This file contains 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 custom content (such as a video) before the LearnDash content | |
* This example adds a video from BuddyBoss to the app | |
* Add this code to a plugin, change the post meta value as necessary | |
*/ | |
add_filter("learndash_content", function($content, $post) { | |
if( class_exists('AppPresser') && AppPresser::is_app() ) { |