This gist is about:
- https://twitter.com/taylorotwell/status/600680897550098432
- https://twitter.com/Ocramius/status/600705252539691008
Mainly:
function
cannot (should not) be used when side-effects occur
This gist is about:
Mainly:
function
cannot (should not) be used when side-effects occur(function( $ ) { | |
'use strict'; | |
$(function() { | |
alert( 'JavaScript Loaded!' ); | |
}); | |
})( jQuery ); |
<?php | |
$results = $wpdb->get_results( | |
" | |
SELECT key2.meta_value as cat_id, $wpdb->posts.ID as action_id -- , $wpdb->posts.post_title as title | |
FROM $wpdb->posts | |
INNER JOIN $wpdb->postmeta key1 | |
ON $wpdb->posts.ID = key1.post_id | |
INNER JOIN $wpdb->postmeta key2 | |
ON $wpdb->posts.ID = key2.post_id | |
WHERE key1.meta_key = 'active' |
<?php | |
/** | |
* WordPress Query Comprehensive Reference | |
* Compiled by luetkemj - luetkemj.com | |
* | |
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters | |
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php | |
*/ | |
$args = array( |
<?php | |
// http://wordpress.stackexchange.com/questions/64338/how-to-get-a-meta-value-from-all-post | |
// https://wordpress.org/support/topic/how-to-get-a-meta-values-from-all-posts-in-a-special-category | |
function get_meta_values( $key = '', $type = 'post', $status = 'publish' ) { | |
if( empty( $key ) ) return; | |
global $wpdb; | |
$r = $wpdb->get_results( $wpdb->prepare( " | |
SELECT p.ID, pm.meta_value FROM {$wpdb->postmeta} pm |
$(function () { | |
//grab the entire query string | |
var query = document.location.search.replace('?', ''); | |
//extract each field/value pair | |
query = query.split('&'); | |
//run through each pair | |
for (var i = 0; i < query.length; i++) { | |
//split up the field/value pair into an array | |
var field = query[i].split("="); | |
//target the field and assign its value |
function list_hooked_functions($tag=false){ | |
global $wp_filter; | |
if ($tag) { | |
$hook[$tag]=$wp_filter[$tag]; | |
if (!is_array($hook[$tag])) { | |
trigger_error("Nothing found for '$tag' hook", E_USER_WARNING); | |
return; | |
} | |
} | |
else { |
Snippet: [[SnippetName]] | |
Chunk: [[$ChunkName]] | |
System Setting: [[++SettingName]] | |
TV: [[*fieldName/TvName]] | |
Link tag: [[~PageId? ¶mName=`value`]] | |
Placeholder: [[+PlaceholderName]] | |
<?php |
<?php | |
$month_arr = array('01' => 'Янв', | |
'02' => 'Фев', | |
'03' => 'Мар', | |
'04' => 'Апр', | |
'05' => 'Мая', | |
'06' => 'Июн', | |
'07' => 'Июл', | |
'08' => 'Авг', | |
'09' => 'Сен', |