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( 'wp_dashboard_setup', 'my_dashboard_setup' ); | |
function my_dashboard_setup() { | |
wp_add_dashboard_widget('themefm-dashboard-reader', 'Latest from Theme.fm' , 'my_dashboard_content', $control_callback = null); | |
} | |
function my_dashboard_content() { | |
echo "<p>Dashboard Widget Content</p>"; | |
} |
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 query_posts($query_string . '&cat=-3,-8'); ?> | |
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> | |
<div class="post"> | |
<!-- Display the Title as a link to the Post's permalink. --> | |
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> | |
<!-- Display the date (November 16th, 2009 format) and a link to other posts by this posts author. --> | |
<small><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?></small> |
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 | |
/* | |
* This snippet overrides the default post ordering in the edit posts table (admin), | |
* while keeping other post ordering options (by clicking on the table headings) | |
* still available. Useful for CMS-like setups and could be tweaked for | |
* custom post types as well | |
* | |
* Konstantin Kovshenin | |
* http://theme.fm | |
*/ |
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 | |
/** Both color schemes **/ | |
add_filter( 'twentyeleven_color_schemes', 'twentyeleven_color_schemes_both' ); | |
add_action( 'twentyeleven_enqueue_color_scheme', 'twentyeleven_enqueue_color_scheme_both' ); | |
function twentyeleven_color_schemes_both( $color_schemes ) { | |
$color_schemes['orange'] = array( | |
'value' => 'orange', | |
'label' => __( 'Orange', 'twentyeleven' ), | |
'thumbnail' => get_stylesheet_directory_uri() . '/orange.png', |
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
blockquote.tweet { | |
border-left: solid 4px #ccc; | |
padding-left: 8px; | |
} |
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
mysql> explain SELECT SQL_CALC_FOUND_ROWS wp_posts.post_title FROM wp_posts INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) WHERE 1=1 AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') AND ( (wp_postmeta.meta_key = 'my-field' AND CONVERT(wp_postmeta.meta_value, CHAR) = 'some value') ) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 10; | |
+----+-------------+-------------+--------+---------------------------------+----------+---------+---------------------------+------+----------------------------------------------+ | |
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | | |
+----+-------------+-------------+--------+---------------------------------+----------+---------+---------------------------+------+----------------------------------------------+ | |
| 1 | SIMPLE | wp_postmeta | ref | post_id,meta_k |
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 | |
class Some_Plugin { | |
function previous_gallery_post_link() { | |
add_filter( 'posts_where', array( &$this, 'filter_where_date_lt' ) ); | |
$previous = new WP_Query( array( | |
'post_type' => 'post', | |
'tax_query' => array( | |
'relation' => 'AND', | |
array( |
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 vtp_install_data() { | |
add_action( 'init', 'vtp_setup_terms', 11 ); | |
} | |
register_activation_hook( __FILE__, 'vtp_install_data' ); | |
function vtp_setup_terms() { | |
if ( ! term_exists( 'Customer', 'account_type' ) ) { | |
wp_insert_term( 'Customer', 'account_type'); |
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
function filter_where_this_week( $where ) { | |
$where .= " AND post_date >= '" . date( 'Y-m-d 00:00:00', strtotime( '-7 days', current_time( 'timestamp' ) ) ) . "' AND post_date < '" . date( 'Y-m-d 23:59:59', strtotime( '+0 days', current_time( 'timestamp' ) ) ) . "' "; | |
return $where; | |
} |
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
<select name="account" id="account"> | |
<?php foreach ( $accounts as $account ) : | |
<option value='<?php echo $account->ID; ?>' <?php selected( in_array( $account->ID ) ); ?> > | |
<?php echo $account->post_title; ?> | |
</option> | |
</select> |
OlderNewer