Skip to content

Instantly share code, notes, and snippets.

//Max Clicks
var i = 0;
var el = document.getElementById("cb-dust-particles");
el.addEventListener("click", function(){
i++;
if(i == 10) {
pJSDom[0].pJS.interactivity.events.onclick.enable = false;
}
}, false);
// Custom Templates Shortcode to Get Templates from the /templates Directory
// Usage: [gettemplate name="templatename"]
function prefix_templates_shortcode_function( $atts ){
$a = shortcode_atts( array(
'name' => 'none'
), $atts );
ob_start();
get_template_part('templates/' . $a['name']);
return ob_get_clean();
//Access the global settings when setting up a custom module.
public function global_settings_method()
{
$settings = FLBuilderModel::get_global_settings();
return $settings->responsive_breakpoint;
}
if (_typeface_js && _typeface_js.loadFace) _typeface_js.loadFace({"glyphs":{"0":{"ha":656,"x_min":0,"x_max":0,"o":"m 328 -17 b 586 447 494 -17 586 153 b 328 906 586 742 494 906 b 69 447 161 906 69 742 b 328 -17 69 153 161 -17 z m 328 22 b 114 447 197 22 114 172 b 328 867 114 722 197 867 b 542 447 458 867 542 722 b 328 22 542 172 458 22 z "},"1":{"ha":656,"x_min":0,"x_max":0,"o":"m 119 0 l 569 0 l 569 39 l 372 39 l 372 889 l 336 889 b 172 836 297 867 242 847 l 172 806 l 331 806 l 331 39 l 119 39 z "},"2":{"ha":656,"x_min":0,"x_max":0,"o":"m 58 0 l 592 0 l 592 39 l 272 39 b 122 33 222 39 172 36 b 547 661 383 310 547 481 b 303 906 547 808 458 906 b 56 775 197 906 119 847 l 86 747 b 300 867 142 817 217 867 b 503 661 442 867 503 775 b 58 28 503 503 358 336 z "},"3":{"ha":656,"x_min":0,"x_max":0,"o":"m 319 -17 b 583 233 469 -17 583 81 b 378 467 583 361 489 444 l 378 472 b 550 694 475 504 550 575 b 317 906 550 828 447 906 b 81 797 214 906 139 856 l 108 767 b 317 867 158 822 233 867 b 506 692 431 867 506 797 b 219 48
//Register Meta with Rest API
add_action( 'rest_api_init', 'prefix_register_custom_meta' );
function prefix_register_custom_meta() {
register_rest_field(
'post',
'_prefix_url',
array(
'get_callback' => 'prefix_get_custom_meta',
'update_callback' => null,
'schema' => null,
/**
* Retrieve custom meta for use in the REST API
*
* @param array $object Details of current post.
* @param string $field_name Name of field.
* @param WP_REST_Request $request Current request
*
* @return mixed
*/
function prefix_get_custom_meta( $object, $field_name, $request ) {
@bacoords
bacoords / example-functions.php
Last active June 7, 2016 15:39
CMB2 Example Functions
// Source: CMB2 Wiki
// https://github.com/WebDevStudios/CMB2/blob/master/example-functions.php
// https://github.com/WebDevStudios/CMB2/wiki/Basic-Usage
add_action( 'cmb2_admin_init', 'prefix_register_demo_metabox' );
function prefix_register_demo_metabox() {
$prefix = '_prefix_'
@bacoords
bacoords / at_a_glance_CPT.css
Last active April 20, 2016 15:29
Change icon for "At a Glance" on WP Dashboard
/* Change icon for "At a Glance" on WP Dashboard */
#dashboard_right_now .{custom-post-type}-count a:before, #dashboard_right_now .{custom-post-type}-count span:before{
content: "{glyphicon}";
}
/*Example*/
#dashboard_right_now .invoice-count a:before, #dashboard_right_now .invoice-count span:before{
content: "\f529";
}
@bacoords
bacoords / page-insert-from-json-file.php
Last active March 15, 2020 08:20
Page template ton insert via json file
<?php
//Template Name: Insert Json File
//Testing Mode First
$test = true;
//If we've uploaded our JSON file with our theme
$url = get_template_directory_uri() . 'json/my-new-posts.json';
//Convert our JSON into a PHP Array
@bacoords
bacoords / page-insert-from-google-sheets.php
Last active December 8, 2016 22:27
Page template to insert Google Sheets JSON feed into WordPress
<?php
//Template Name: Insert Json from Google Sheets
//Testing Mode First
$test = true;
//Google Sheet JSON Feed Url
$url = 'https://spreadsheets.google.com/feeds/list/{{UNIQUE-ID}}/od6/public/values?alt=json';
//Convert our JSON into a PHP Array