Skip to content

Instantly share code, notes, and snippets.

View scottopolis's full-sized avatar

Scott Bolinger scottopolis

View GitHub Profile
@scottopolis
scottopolis / apppresser-learndash-content.php
Last active January 10, 2021 19:02
Custom LearnDash Content for AppPresser
<?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() ) {
@scottopolis
scottopolis / appcommunity-template-hook.php
Last active March 25, 2019 18:34
AppCommunity Template Hook Example
<?php
// this code goes in a plugin
// Add a member profile field to the app
add_filter( 'appcommunity_prepare_user', function( $response, $request ) {
$response['appp']['user_actions'] = '<div padding><p class="custom-profile-field"><strong>' . xprofile_get_field( 1, $request['id'] )->name . '</strong><br/>' . xprofile_get_field_data( 1, $request['id'] ) . '</p><p class="custom-profile-field"><strong>' . xprofile_get_field( 2, $request['id'] )->name . '</strong><br/>' . xprofile_get_field_data( 2, $request['id'] ) . '</p></div>';
return $response;
@scottopolis
scottopolis / appcommunity-action.php
Last active September 19, 2018 18:22
AppCommunity Action Hook Example
<?php
// add this code to a plugin to modify a response
add_action('appcommunity_activity_get_item', function( $item, $retval, $request ) {
$retvalhasbadwords = false;
// check for bad words here...
if( $retvalhasbadwords ) {
@scottopolis
scottopolis / component-demo.css
Last active July 27, 2018 17:21
Custom Component Demo CSS
/* Custom CSS for the custom component demo found here: https://gist.github.com/scottopolis/ab9fbf16d67513f29e30626f6cc330d5
Add this CSS in your app customizer under Colors => Custom CSS */
ap-list .event-date {
float:right;
color: #999;
font-weight: bold;
margin-top: 10px
}
ap-list ion-list {
@scottopolis
scottopolis / learndash-demo-page.html
Last active July 12, 2018 17:59
LearnDash Custom Page Layout
<h4 padding><ion-icon name="star"></ion-icon> Featured Courses</h4>
<ap-slider wp="true" card="true" route="https://mysite.com/wp-json/wp/v2/sfwd-courses"></ap-slider>
<h4 padding><ion-icon name="list"></ion-icon> All Courses</h4>
<ap-list wp="true" card="true" class="col-2" route="https://mysite.com/wp-json/wp/v2/sfwd-courses"></ap-list>
@scottopolis
scottopolis / appp-segment.html
Last active June 26, 2018 18:15
AppPresser ion-segment
<!-- add this code to a custom HTML page, change out your variables and lists -->
<ion-segment [(ngModel)]="event">
<ion-segment-button value="schedule">
Schedule
</ion-segment-button>
<ion-segment-button value="speakers">
Speakers
</ion-segment-button>
<ion-segment-button value="sponsors">
@scottopolis
scottopolis / custom-components.html
Last active December 15, 2018 19:25
AppPresser Custom Page Example
<!--
Example code for custom HTML pages https://docs.apppresser.com/article/462-html-samples-for-custom-pages
You also need to add custom CSS to make this look like the demo. Find the CSS here: https://gist.github.com/scottopolis/3fb840b1620bd723c2df44cf117f41c6
-->
<span class="list-header">Upcoming events:</span>
<ap-list route="https://mysite.com/wp-json/wp/v2/posts?per_page=1"></ap-list>
<ion-card>
@scottopolis
scottopolis / cordova-in-app-purchase-subscriptions.ts
Last active May 9, 2018 06:41
Cordova In App Purchase Subscriptions
import {Injectable} from '@angular/core';
import {Device} from '@ionic-native/device';
import {InAppPurchase} from '@ionic-native/in-app-purchase';
import {Storage} from '@ionic/storage';
import {AppAds} from '../appads/appads';
import {Http, Headers, RequestOptions} from '@angular/http';
import 'rxjs/add/operator/map';
import { Events } from 'ionic-angular';
@scottopolis
scottopolis / appp_media_url.php
Last active February 4, 2019 22:25
Add AppPresser Media URL Programatically
<?php
// This example is for the Seriously Simple Podcasting plugin. To use with a different plugin, just replace the post type and meta key
// You would only run this one time, don't leave this code active on your site
$the_query = new WP_Query( array( 'post_type' => 'podcast', 'posts_per_page' => 999 ) );
// The Loop
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
$the_query->the_post();
// replace audio_file with the meta key to your existing media url. No markup, should just be a url string.
@scottopolis
scottopolis / stripe-payment-woocommerce-api.html
Last active March 7, 2018 16:44
Create Stripe Payment for WooCommerce API
<html>
<body>
<!--
* See tutorial on scottbolinger.com
* 1. add your publishable key and website url below
* 2. install a plugin that adds the payment endpoint, such as https://github.com/scottopolis/sb-app-integration
* 3. create a pending order in WooCommerce before sending the payment, because you need the order ID woocommerce.github.io/woocommerce-rest-api-docs/#create-an-order
-->