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 by specific element type, attribute and value | |
$("div[data-myattr='myvalue']").doSomething(); | |
// Select by specific element type and attribute | |
$("div[data-myattr]").doSomething(); | |
// Select by specific attribute | |
$('[data-myattr]').doSomething(); | |
// See more: http://api.jquery.com/contains-selector/ |
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
.bubble { | |
position: relative; | |
height: 75px; | |
width: 100%; | |
border-radius: 5px; | |
margin-bottom: 20px; | |
} | |
.red.bubble { | |
background-color: pink; | |
} |
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
//Basics & WordPress Standards | |
$absolute_path = __FILE__; | |
$path_to_file = explode( 'wp-content', $absolute_path ); | |
$path_to_wp = $path_to_file[0]; | |
require_once( $path_to_wp.'/wp-load.php' ); |
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
/** | |
* Get posts and group by taxonomy terms. | |
* @param string $posts Post type to get. | |
* @param string $terms Taxonomy to group by. | |
* @param integer $count How many post to show per taxonomy term. | |
*/ | |
function list_posts_by_term( $posts, $terms, $count = -1 ) { | |
$tax_terms = get_terms( $terms, 'orderby=name'); | |
foreach ( $tax_terms as $term ) { | |
echo '<h2>' . $term->name . '</h2> <ul>'; |
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 | |
if (!function_exists('get_post_id_by_meta_key_and_value')) { | |
/** | |
* Get post id from meta key and value | |
* @param string $key | |
* @param mixed $value | |
* @return int|bool | |
*/ | |
function get_post_id_by_meta_key_and_value($key, $value) { |
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 app = app || {}; | |
//object literal | |
app = { | |
init: function(){ | |
this.cache(); | |
this.bind(); | |
}, | |
cache: function(){ | |
this.anchor = $( 'a' ); |
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 | |
/** | |
* Merge multiple WP_Error objects together | |
* | |
* @return WP_Error | |
*/ | |
function wp_error_merge() { | |
$wp_error_merged = new WP_Error(); | |
$wp_errors = func_get_args(); |
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
jQuery( function( $ ) { | |
if ( 'undefined' === typeof FB ) | |
return; | |
if ( $( 'body' ).hasClass( 'single-post' ) || $( 'body' ).hasClass( 'page' ) ) { | |
var $comments_div = $( '<div/>' ); | |
$comments_div.addClass( 'fb-comments' ); | |
$comments_div.attr( 'data-href', document.location ); | |
$comments_div.appendTo( $( '.primary-content' ) ); |
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 = new WP_Query( array( 'posts_per_page' => 100, 'fields' => 'ids' ) ); ?> | |
<?php if ( $query->have_posts() ) : | |
$post_ids = $query->posts; | |
shuffle( $post_ids ); | |
$post_ids = array_splice( $post_ids, 0, 12 ); | |
foreach ( $post_ids as $post_id ) : | |
$post = get_post( $post_id ); | |
setup_postdata( $post ); | |
?> |
OlderNewer