Skip to content

Instantly share code, notes, and snippets.

@wokamoto
wokamoto / post_meta_transient.php
Last active June 16, 2016 16:36
[WordPress] post meta transient
<?php
/**
* Delete a post meta transient.
*/
function delete_post_meta_transient( $post_id, $transient, $value = null ) {
global $_wp_using_ext_object_cache;
$post_id = (int) $post_id;
do_action( 'delete_post_meta_transient_' . $transient, $post_id, $transient );
@r-a-y
r-a-y / gist:5578432
Last active July 23, 2020 06:55
Disable BuddyPress' registration and use WP's instead. Paste this in /wp-content/plugins/bp-custom.php.
/**
* 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' );
<?php
function my_pre_user_query( $query ) {
$where = get_posts_by_author_sql( 'post' ) . " AND MONTH(post_date) = " . date( 'm', strtotime( '-1 month' ) );
$query->query_from = str_replace( get_posts_by_author_sql( 'post' ), $where, $query->query_from );
$query->query_where .= " AND post_count > 0 ";
$query->query_limit .= " LIMIT 5 ";
}
function my_magic_loop() {
@qwertypants
qwertypants / mediaQueries.css
Last active October 3, 2015 07:07
CSS Media Queries template
/* source: all over the interwebz */
/*------------------------ Smartphones ------------------------ */
/* Portrait & Landscape */
@media only screen
and (min-width : 320px)
and (max-width : 480px) {
/* styles */
}
/* Landscape */
<?php
/*
Plugin Name: Test
*/
class My_Like_Button {
function __construct()
{
$this->hooks();
}