Skip to content

Instantly share code, notes, and snippets.

View scottopolis's full-sized avatar

Scott Bolinger scottopolis

View GitHub Profile
<?php
global $post;
global $more;
/* WP query loop for swiper slider */
$args = array(
'post_type' => 'swiper',
'posts_per_page' => $number,
@scottopolis
scottopolis / gist:9214367
Created February 25, 2014 18:04
Ajax WordPress posts via JSON API
<button class="button" id="get_posts">Get Posts</button>
<ul id="statuses">
</ul>
<script type="text/javascript">
/* Requires JSON API plugin installed on remote site http://wordpress.org/plugins/json-api/ */
(function(window, document, $, undefined){
@scottopolis
scottopolis / gist:9395629
Created March 6, 2014 17:58
Phonegap In App Browser
<button onclick="inAppBrowser()">In App Browser</button>
<script>
function inAppBrowser() {
window.open('http://apppresser.com', '_blank');
}
</script>
@scottopolis
scottopolis / gist:bdde1926b1d08b0bb88f
Last active August 29, 2015 14:02
EDD Custom Bundle License Activation Limits
<?php
function sb_edd_filter_license_limit( $limit, $download_id, $license_id, $price_id ) {
$payment_id = get_post_meta( $license_id, '_edd_sl_payment_id', true );
$is_bundle = false;
$bundle_items = array();
$downloads = edd_get_payment_meta_downloads( $payment_id );
if( $downloads ) {
foreach( $downloads as $download ) {
@scottopolis
scottopolis / gist:07c555b9dd0581497f0b
Last active March 16, 2019 20:51
Styling for Display Posts Shortcode
/* Author: Scott Bolinger
* Author URI: http://apppresser.com
*
* Styling for Display Posts Shortcode plugin for use with the AppTheme. Add this code to a child theme style.css file.
* Plugin information: http://www.billerickson.net/shortcode-to-display-posts/
*
*/
ul.display-posts-listing {
list-style-type: none;
@scottopolis
scottopolis / pg-build-api
Last active August 17, 2019 17:34
Phonegap Build Developer API (php curl)
<?php
class PGB_API {
// A single instance of this class.
public static $instance = null;
public static $auth_token = '';
/**
* Creates or returns an instance of this class.
@scottopolis
scottopolis / aws-nexttoken.php
Created February 27, 2015 00:08
How to use the AWS NextToken in PHP. This is for Amazon SNS specifically.
do {
// We only get 100 subscribers, if there's a nextToken, get the next 100
if( $nextToken ) {
$result = $client->listEndpointsByPlatformApplication(array(
'PlatformApplicationArn' => $gcm_arn,
'NextToken' => $nextToken
));
} else {
// Run this the first time, since there's no nextToken yet
$result = $client->listEndpointsByPlatformApplication(array(
@scottopolis
scottopolis / apppresser-device-push
Last active June 17, 2018 20:19
Send AppPresser Push Notification only to certain devices
/*
* Send notifications only to certain devices
*/
// Change this hook
add_action( 'save_post', 'push_to_devices' );
function push_to_devices() {
// this should be an array of user IDs that you want to send the pushes too. AppPresser saves device IDs if the app user is a logged in member of your WordPress site, for example in BuddyPress. This will not work unless the user has logged in through your app.
@scottopolis
scottopolis / gist:f38c09ed4dba11eaadd2
Created July 23, 2015 17:17
Disable WP Touch for AppPresser
add_filter( 'wptouch_should_init_pro', 'appp_disable_wptouch' );
function appp_disable_wptouch( $value ) {
if( class_exists( 'AppPresser' ) && AppPresser::is_app() ) {
$value = false;
}
return $value;
}
@scottopolis
scottopolis / apptheme-ajax-links.js
Last active August 29, 2015 14:26
Add ajax links to AppTheme