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
import Vue from 'vue'; | |
import posts from './components/posts.vue'; | |
window.axios = require('axios'); | |
window.Vue = Vue; | |
Vue.component('posts', posts); | |
const app = new Vue({ | |
el: '#app', |
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 | |
if ( !function_exists( 'is_rest' ) ) { | |
/** | |
* Checks if the current request is a WP REST API request. | |
* | |
* Case #1: After WP_REST_Request initialisation | |
* Case #2: Support "plain" permalink settings and check if `rest_route` starts with `/` | |
* Case #3: It can happen that WP_Rewrite is not yet initialized, | |
* so do this (wp-settings.php) |
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 | |
// Apply Bootstrap 4 custom checkboxes and radio buttons to Gravity Fields generated forms | |
// Derived from https://jayhoffmann.com/using-gravity-forms-bootstrap-styles/ | |
add_filter( 'gform_field_container', 'add_bootstrap_control_class', 10, 6 ); | |
function add_bootstrap_control_class( $field_container, $field, $form, $css_class, $style, $field_content ) { | |
$id = $field->id; | |
$field_id = is_admin() || empty( $form ) ? "field_{$id}" : 'field_' . $form['id'] . "_$id"; |
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 | |
// Init | |
// ----------------------------------------------------------------------- | |
define('DOING_AJAX', true); | |
define('SHORTINIT', true); | |
// WP Load | |
// ----------------------------------------------------------------------- | |
require('wp-load.php'); |
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
/** | |
* Block dependencies | |
*/ | |
import icon from './icon'; | |
import SelectTeam from '../select-team'; | |
//import './style.scss'; | |
import './editor.scss'; | |
/** | |
* Internal block libraries |
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 | |
// Place the following code in your theme's functions.php file | |
// override the quantity input with a dropdown | |
function woocommerce_quantity_input($data = null) { | |
global $product; | |
$defaults = array( | |
'input_name' => 'quantity', | |
'input_value' => '1', |
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 | |
/** | |
* This class handles downloading a remote image file and inserting it | |
* into the WP Media Library. | |
* | |
* Usage: | |
* $download_remote_image = new KM_Download_Remote_Image( $url ); | |
* $attachment_id = $download_remote_image->download(); | |
* |
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
#!/usr/bin/env bash | |
sudo npm install -g create-react-app | |
create-react-app my-app | |
cd my-app | |
npm i -s axios bootstrap jquery popper.js react-redux react-router-dom redux redux-form redux-thunk | |
npm run eject |
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 | |
/** | |
* Wrapper function: Applies WP Rocket’s LazyLoad to wp_get_attachment_image() | |
* | |
* @link https://developer.wordpress.org/reference/functions/wp_get_attachment_image/ | |
* @link https://github.com/wp-media/wp-rocket/blob/v2.10.9/inc/front/lazyload.php#L24-L47 | |
* | |
* @param int $attachment_id (Required) Image attachment ID. | |
* @param string|array $size (Optional) Image size. Accepts any | |
* valid image size, or an array of width |
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 phpToMoment(str) { | |
let replacements = { | |
'd' : 'DD', | |
'D' : 'ddd', | |
'j' : 'D', | |
'l' : 'dddd', | |
'N' : 'E', | |
'S' : 'o', | |
'w' : 'e', |
NewerOlder