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://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 |
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 | |
/** | |
* 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( |
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 | |
$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' |
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 | |
$ajax = isset($_SERVER['HTTP_X_REQUESTED_WITH']) && | |
$_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'; |
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 | |
$string = 'first@mail.ru=From first||second@mail.ru=From second'; | |
$mails = explode('||', $string); | |
$to = array(); | |
foreach ($mails as $mail) { | |
list($key, $value) = explode('=', $mail); | |
$to[trim($key)] = trim($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
$(document).ready(function () { | |
/*************** FIRST EXAMPLE *********************/ | |
$.ajaxSetup({ | |
beforeSend: function() { | |
$('#general-ajax-load').fadeIn(); | |
}, | |
complete: function() { | |
$('#general-ajax-load').fadeOut(); | |
}, |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>[[++site_name]] - [[*pagetitle]]</title> | |
<base href="[[++site_url]]" /> | |
<style> | |
body {margin:auto; width:800px; color: #5F5F5F;} | |
</style> | |
</head> |
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($){ | |
var requests = {}; | |
$(function(){ | |
// Determine which data you need and call the getData()... | |
// Stubbing in some example data... | |
// This is a unique request and would make an ajax call | |
getData({ | |
foo: 'bar' |
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
$.when( | |
$.ajax('ajax.php') | |
).then(function(data){ | |
// Here I can work with data like I would with a regular ajax request | |
alert($(data).find('mynode').text()); | |
}) |
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 | |
/** | |
* SplClassLoader implementation that implements the technical interoperability | |
* standards for PHP 5.3 namespaces and class names. | |
* | |
* http://groups.google.com/group/php-standards/web/final-proposal | |
* | |
* // Example which loads classes for the Doctrine Common package in the | |
* // Doctrine\Common namespace. |