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: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
@scottopolis
scottopolis / angular-base64-factory
Last active August 31, 2015 18:22
AngularJS Base64 Factory
angular.module('myApp.services', [])
.factory('Base64', function() {
var keyStr = 'ABCDEFGHIJKLMNOP' +
'QRSTUVWXYZabcdef' +
'ghijklmnopqrstuv' +
'wxyz0123456789+/' +
'=';
return {
encode: function (input) {
@scottopolis
scottopolis / wp-api-jquery-ajax.html
Last active October 6, 2015 06:20
Simple WP-API Ajax to get posts
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>My App</title>
<style type="text/css">
body {
@scottopolis
scottopolis / appbuddy-login-modal-toolbar.php
Created November 9, 2015 18:37
AppBuddy use login modal
<?php
/*
* Show login button in toolbar if user not logged in. AppBuddy only
* Put this code in a child theme functions.php file
*/
function my_appbuddy_modal_btn( $button ) {
$args = '';
@scottopolis
scottopolis / wp-api-custom-taxonomies.php
Created October 27, 2015 22:27
Add custom taxonomies to the WP-API
<?php
function ms_add_tax_to_api() {
$taxonomies = get_taxonomies( '', 'objects' );
foreach( $taxonomies as $taxonomy ) {
$taxonomy->show_in_rest = true;
}
}
add_action( 'init', 'ms_add_tax_to_api', 30 );