This file contains hidden or 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 | |
// In theme's functions.php. | |
function pl_remove_facebook_comments() { | |
remove_filter( 'the_content', 'fb_comments_automatic', 30 ); | |
remove_filter( 'comments_array', 'fb_close_wp_comments' ); | |
remove_filter( 'the_posts', 'fb_set_wp_comment_status' ); | |
remove_action( 'wp_enqueue_scripts', 'fb_hide_wp_comments' ); | |
remove_filter( 'comments_number', 'fb_get_comments_count' ); | |
} |
This file contains hidden or 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 $color_palette = get_post_meta( get_the_ID(), 'color-palette' ); ?> | |
<?php foreach( $color_palette[ 0 ] as $color ) : ?> | |
<div style="width: 50px; height: 50px; background: #<?php echo $color; ?>"></div> | |
<?php endforeach; ?> |
This file contains hidden or 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 | |
$cs_remote_cache = new CS_Remote_Cache(); | |
$key = 'whatever-key-you-want'; // needs to be unique | |
$data = ''; // the data you want to cache | |
$expire = 30; // expiration in seconds |
This file contains hidden or 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 | |
global $wpdb; | |
$author_id = 12; | |
$result = $wpdb->query( $wpdb->prepare( "SELECT ID from $wpdb->posts where post_author = %d AND post_status = 'publish' AND post_type = 'post' LIMIT 10", $author_id ) ); | |
$authors_post_ids = wp_list_pluck( $result, 'ID' ); |
This file contains hidden or 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 | |
$author_id = 12; | |
$query = new WP_Query( array( 'author' => $author_id ) ); | |
$authors_post_ids = wp_list_pluck( $query->posts, 'ID' ); | |
?> |
This file contains hidden or 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 authors_import = jQuery( '#authors li' ); | |
authors_import.each( function() { | |
var name_data = jQuery( this ).find( 'strong' ).html(); | |
var username, nicename; | |
username = name_data.substring( name_data.indexOf( '(' ) + 1, name_data.indexOf( ')' ) ); | |
This file contains hidden or 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
update wp_options set option_value='http://example.com' where option_name = 'siteurl' or option_name = 'home' | |
update wp_blogs set domain='example.com' where blog_id = '1' or blog_id = '2' | |
update wp_2_options set option_value='http://example.com/second-blog-path' where option_name='siteurl' or option_name='home' | |
update wp_site set domain='example.com' where id='1' | |
update wp_sitemeta set meta_value='http://example.com' where meta_key='siteurl' |
This file contains hidden or 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 | |
$server_name = 'example.database.windows.net'; | |
$database = 'database-name'; | |
$username = 'user@example'; | |
$password = 'thepassword'; |
This file contains hidden or 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 | |
WP_CLI::add_command( 'export-feedback', 'Export_Feedback_Command' ); | |
class Export_Feedback_Command extends WP_CLI_Command { | |
private $args = array(); | |
/** | |
* This command can be used to export all feedbacks for the current site. |
This file contains hidden or 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 | |
function modify_contact_form_field_html( $field_html, $field_label, $post_id ) { | |
// Add HTML before the field. | |
$field_html = '<span>Before the field.</span>' . $field_html; | |
// Add HTML after the field. | |
$field_html .= '<span>After the field.</span>'; | |
// Conditionally add based on field label and post id |
OlderNewer