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
#!/bin/bash | |
# | |
# Version 1.4 | |
# | |
# twrp.sh -- a TWRP compatible backup script for your computer | |
# Brought to you by inhies | |
# | |
# This script creates TWRP compatible backups over usb using adb and magikz | |
# By default it makes a folder in the standard TWRP date--time format (I think) | |
# To restore these backups, place the folder in /sdcard/TWRP/BACKUPS/<serialnumber>/ |
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
add_filter( 'json_query_vars', 'slug_allow_meta' ); | |
function slug_allow_meta( $valid_vars ) { | |
$valid_vars = array_merge( $valid_vars, array( 'meta_key', 'meta_value' ) ); | |
return $valid_vars; | |
} | |
// | |
$url = 'posts?filter[meta_key]=foo&filter[meta_value]=bar'; |
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_action( 'pre_get_posts', function ( $query ) { | |
if ( $query->is_main_query() && !is_admin() && $query->is_post_type_archive( 'name_of_post_type') ) { | |
$query->set('orderby', 'meta_value_num'); | |
$query->set('meta_key', 'custom_field_name'); | |
$query->set('order', 'ASC'); | |
} | |
} |
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 | |
/** | |
* The template used for displaying private page content | |
* | |
* @package WordPress | |
* @subpackage Twenty_Sixteen | |
* @since Twenty Sixteen 1.0 | |
*/ | |
$private_page_class = 'class="type-page ' . join( ' ', get_post_class( $class, $post_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
$( '.something' ).on( 'click', function (e) { | |
e.preventDefault(); | |
var location = window.location; | |
var url = location.origin + location.pathname + location.hash; | |
history.replaceState( null, '', url ); | |
}); |
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
add_filter( 'caldera_forms_autopopulate_options_post_value_field', 'givewp_customer_addon_purchases', 24, 2 ); | |
function givewp_customer_addon_purchases() | |
{ | |
$current_user = wp_get_current_user(); | |
$purchases = edd_get_users_purchases($current_user->user_email, 100, false, 'any'); | |
if ( $purchases ) { | |
foreach ($purchases as $purchase) { | |
$licenses = edd_software_licensing()->get_licenses_of_purchase( $purchase->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
add_action( 'init', function(){ | |
if ( ! is_admin()) { | |
if( is_ssl() ){ | |
$protocol = 'https'; | |
}else { | |
$protocol = 'http'; | |
} | |
/** @var WP_Scripts $wp_scripts */ | |
global $wp_scripts; |
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 | |
namespace App; | |
class WpApi { | |
protected static $url = 'https://calderaforms.com/wp-json/wp/v2/'; | |
public static function getPost(int $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 | |
add_filter( 'the_content', function( $content ){ | |
$post = get_post(); | |
if( 42 ===$post->ID ){ | |
$form = 'cf1234567'; | |
$content .= Caldera_Forms::render_form( $form ); | |
$content .= Caldera_Forms_Entry_Viewer::form_entry_viewer_2( $form ); | |
} | |
}); |
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_filter( 'caldera_forms_render_get_field', function( $field ) { | |
if( 'fld123456' == $field[ 'ID' ] ){ | |
$field[ 'config' ][ 'default' ] = esc_url_raw( caldera_forms_get_current_url() ); | |
} | |
return $field; | |
}); |
OlderNewer