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
angular.module('myApp.services', []) | |
.factory('Base64', function() { | |
var keyStr = 'ABCDEFGHIJKLMNOP' + | |
'QRSTUVWXYZabcdef' + | |
'ghijklmnopqrstuv' + | |
'wxyz0123456789+/' + | |
'='; | |
return { | |
encode: function (input) { |
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
<!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 { |
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 | |
// This is a temporary solution until register_post_type_args is available | |
// After adding your CPT, you can find it at mysite.com/wp-json/wp/v2/[slug] | |
function sb_add_cpts_to_api() { | |
global $wp_post_types; | |
// Add CPT slugs here | |
$arr = ['fake','movie','books']; |
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 | |
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 ); |
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 | |
/* Adds all user meta to the /wp-json/wp/v2/user/[id] endpoint */ | |
function sb_user_meta( $data, $field_name, $request ) { | |
if( $data['id'] ){ | |
$user_meta = get_user_meta( $data['id'] ); | |
} | |
if ( !$user_meta ) { | |
return new WP_Error( 'No user meta found', 'No user meta found', array( 'status' => 404 ) ); | |
} |
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 featured image url to api response | |
* This will (hopefully) be unnecessary if the API team adds it to core | |
* | |
*/ | |
add_action( 'rest_api_init', 'sb_register_featured_urls' ); | |
function sb_register_featured_urls() { | |
register_api_field( 'post', |
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 | |
/* | |
* 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 = ''; |
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
/* Custom Loop for a page in an AppPresser app */ | |
function app_custom_loop( $content ) { | |
// edit this with your desired page slug | |
if( is_page( 'featured' ) ) { | |
// add your custom query args here | |
$args = array(); | |
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 | |
// Author: Scott Bolinger https://apppresser.com | |
/* Add register link to login modal */ | |
add_action( 'appp_login_modal_after', 'app_register_link' ); | |
function app_register_link() { | |
if( is_user_logged_in() ) | |
return; |