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 | |
// specify the REST web service to interact with | |
$baseurl = '<<instanceurl>>/rest/v10'; | |
/** | |
* Authenicate and get back token | |
*/ | |
$curl = curl_init($baseurl . "/oauth2/token"); | |
curl_setopt($curl, CURLOPT_POST, true); |
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
function change_upload_path( $path_info, $form_id ) { | |
$path_info['path'] = get_home_path().'wp-content/uploads/docs/'; | |
$path_info['url'] = get_site_url().'/wp-content/uploads/docs/'; | |
return $path_info; | |
} | |
add_filter( 'gform_upload_path', 'change_upload_path', 10, 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
/** | |
* Clears WC Cart on Page Load | |
* (Only when not on cart/checkout page) | |
*/ | |
add_action( 'wp_head', 'bryce_clear_cart' ); | |
function bryce_clear_cart() { | |
if ( wc_get_page_id( 'cart' ) == get_the_ID() || wc_get_page_id( 'checkout' ) == get_the_ID() ) { | |
return; | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"> | |
<meta charset="utf-8"> | |
<title>Google Maps JavaScript API v3 Example: Geocoding Simple</title> | |
<link href="https://developers.google.com/maps/documentation/javascript/examples/default.css" rel="stylesheet"> | |
<script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script> | |
<script> |
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 | |
/** | |
* Implementation of Example converter. | |
*/ | |
class Kunena extends BBP_Converter_Base { | |
function __construct() { | |
parent::__construct(); | |
$this->setup_globals(); |
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 Image Upload to Series Taxonomy */ | |
// Add Upload fields to "Add New Taxonomy" form | |
function add_series_image_field() { | |
// this will add the custom meta field to the add new term page | |
?> | |
<div class="form-field"> | |
<label for="series_image"><?php _e( 'Series Image:', 'journey' ); ?></label> |
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
/****************************************** | |
* get latest post | |
* use in loop if ( is_latest() ) { stuff; } | |
******************************************/ | |
function is_latest() { | |
global $post; | |
$loop = get_posts( 'numberposts=1' ); | |
$latest = $loop[0]->ID; | |
return ( $post->ID == $latest ) ? true : false; | |
} |
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
// Usage: | |
// get_id_by_slug('any-page-slug'); | |
function get_id_by_slug($page_slug) { | |
$page = get_page_by_path($page_slug); | |
if ($page) { | |
return $page->ID; | |
} else { | |
return null; | |
} |
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
<html> | |
<head> | |
<title>Google Maps Multiple Markers</title> | |
<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script> | |
</head> | |
<body> | |
<div id="map" style="height: 400px; width: 500px;"> | |
</div> | |
<script type="text/javascript"> |
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
/* | |
* custom pagination with bootstrap .pagination class | |
* source: http://www.ordinarycoder.com/paginate_links-class-ul-li-bootstrap/ | |
*/ | |
function bootstrap_pagination( $echo = true ) { | |
global $wp_query; | |
$big = 999999999; // need an unlikely integer | |
$pages = paginate_links( array( |
NewerOlder