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 | |
/** | |
* Set excerpt from ACF field | |
*/ | |
add_action('acf/save_post', function($post_id) { | |
$post_excerpt = get_field( 'short_description', $post_id ); | |
if ( ( !empty( $post_id ) ) AND ( $post_excerpt ) ) { |
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
var multilineString = (function(){ /* | |
this | |
is | |
a | |
multiline | |
string. | |
*/}).toString().split('\n').slice(1, -1).join('\n'); | |
console.log(multilineString); |
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 | |
$path = str_replace( $_SERVER['DOCUMENT_ROOT'], '', dirname( $_SERVER['SCRIPT_FILENAME'] ) ); | |
$path_parts = explode( '/', $path ); | |
while ( count( $path_parts ) > 0 ) { | |
$path = $_SERVER['DOCUMENT_ROOT'] . implode( '/', $path_parts ) . '/wp-config.php'; | |
if ( file_exists( $path ) ) { | |
include( $path ); | |
break; | |
} else { | |
array_pop( $path_parts ); |
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
/** | |
* Disables BuddyPress' registration process and fallsback to WordPress' one. | |
*/ | |
function my_disable_bp_registration() { | |
remove_action( 'bp_init', 'bp_core_wpsignup_redirect' ); | |
remove_action( 'bp_screens', 'bp_core_screen_signup' ); | |
} | |
add_action( 'bp_loaded', 'my_disable_bp_registration' ); |
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
Index: domain_mapping.php | |
=================================================================== | |
--- domain_mapping.php (revision 688919) | |
+++ domain_mapping.php (working copy) | |
@@ -685,7 +685,7 @@ | |
} | |
function redirect_to_mapped_domain() { | |
- global $current_blog, $wpdb; | |
+ global $current_blog, $wpdb, $wp_customize; |
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 | |
$html = <<<HTML | |
<html> | |
<head> | |
<script src="http://example.com"></script> | |
</head> | |
<body> | |
<div> | |
<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
// Create the dropdown base | |
$("<select />").appendTo("nav"); | |
// Create default option "Go to..." | |
$("<option />", { | |
"selected": "selected", | |
"value" : "", | |
"text" : "Go to..." | |
}).appendTo("nav select"); | |