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( 'pre_get_posts', 'mc_modify_query_rand_posts' ); | |
function mc_modify_query_rand_posts( $query ) { | |
if ( ! is_admin() && $query->is_main_query() ) | |
$query->set( 'orderby', 'rand' ); | |
} |
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 | |
function maor_twitter_run_wp_user_search_query() { | |
/* There's a reason we're adding the action from here, you'll see later why. */ | |
add_action( 'pre_user_query', 'maor_twitter_help_main' ); | |
/* Create a new WP_User_Query object, limit recordset to 10 */ | |
$wp_user_search = new WP_User_Query( | |
array( | |
'number' => 10 |
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 | |
/* [http://on.fb.me/UAe3H9] */ | |
/* | |
* Posts that have the 'mc_order_key' custom field, and that their (numeric) value is low | |
* will be shown first. If you wish to reverse the order, change the 'order' parameter to | |
* 'DESC'. Also make sure to change the meta key. | |
*/ | |
function mc_reorder_search_results( $query ) { |
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 | |
/* Plugin Name: P2 Force Login | |
* Description: Force logged-out users to log-in in order to view the P2 | |
* Author: Maor Chasen | |
* Author URI: http://maorchasen.com/ | |
* Version: 1.0 | |
*/ | |
function p2fl_force_login() { | |
is_user_logged_in() || auth_redirect(); |
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
if ( $q['m'] ) { | |
$q['m'] = '' . preg_replace('|[^0-9]|', '', $q['m']); | |
$where .= " AND YEAR($wpdb->posts.post_date)=" . substr($q['m'], 0, 4); | |
if ( strlen($q['m']) > 5 ) | |
$where .= " AND MONTH($wpdb->posts.post_date)=" . substr($q['m'], 4, 2); | |
if ( strlen($q['m']) > 7 ) | |
$where .= " AND DAYOFMONTH($wpdb->posts.post_date)=" . substr($q['m'], 6, 2); | |
if ( strlen($q['m']) > 9 ) | |
$where .= " AND HOUR($wpdb->posts.post_date)=" . substr($q['m'], 8, 2); | |
if ( strlen($q['m']) > 11 ) |
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 | |
function my_single_template_by_post_id( $located_template ) { | |
return locate_template( array( sprintf( "single-%d.php", absint( get_the_ID() ) ), $located_template ) ); | |
} | |
add_filter( 'single_template', 'my_single_template_by_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
/* RTL support for Jetpack's Comments Module */ | |
body.rtl #respond form { | |
direction: rtl; | |
} |
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 | |
function roee_get_parent_page_title() { | |
global $post; | |
return ( ! empty( $post->post_parent ) ) ? get_the_title( $post->post_parent ) : false; | |
} |
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 | |
function illuminea_redirect_to_wordcamporg() { | |
if ( is_admin() ) | |
return; | |
$year = date( 'Y' ); | |
wp_redirect( "http://$year.jerusalem.wordcamp.org", 301 ); | |
exit; |
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 | |
/** | |
* Adds a new row that shows the file size under an individual attachment dashboard page | |
* | |
* @author Maor Chasen | |
*/ | |
function mc_attachment_submitbox_filesize() { | |
$post = get_post(); | |
$filesize = @filesize( get_attached_file( $post->ID ) ); |
OlderNewer