This file contains hidden or 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
<script> | |
// Create an array of images that you'd like to use | |
var images = [ | |
'image1.jpg' | |
, 'image2.jpg' | |
, 'image3.jpg' | |
]; | |
// Get a random number between 0 and the number of images | |
var randomNumber = Math.floor( Math.random() * images.length ); |
This file contains hidden or 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 | |
// include our wordpress functions | |
// change relative path to find your WP dir | |
define('WP_USE_THEMES', false); | |
require('./wp-blog-header.php'); | |
// set header for json mime type | |
header('Content-type: application/json;'); | |
This file contains hidden or 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
$.fn.setAllToMaxHeight = function(){ | |
return this.height( Math.max.apply(this, $.map( this , function(e){ return $(e).height() }) ) ); | |
} | |
// usage: $(‘div.unevenheights’).setAllToMaxHeight(); |
This file contains hidden or 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 | |
/** | |
* Related Posts. | |
* | |
* Usage: | |
* To show related by categories: | |
* Add in single.php <?php dfw_related_posts(); ?>. | |
* To show related by tags: | |
* Add in single.php <?php dfw_related_posts('tag'); ?>. |
This file contains hidden or 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
/** | |
* Image preloader | |
* | |
* @link http://engineeredweb.com/blog/09/12/preloading-images-jquery-and-javascript | |
*/ | |
var cache = []; | |
// Arguments are image paths relative to the current page. | |
function pilau_preload_images() { | |
var args_len, i, cache_image; | |
args_len = arguments.length; |
This file contains hidden or 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.ajax({ | |
url: '/wp-admin/admin-ajax.php', | |
type: 'GET',//POST, JSON, XML | |
dataType: 'html', | |
data: ({ | |
action: 'MY_AJAX_FUNCTION', | |
state: state, | |
}), | |
success: function(data){ | |
if (data){ |
This file contains hidden or 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
<!-- Mostra a data como: 28/06/2012 às 01h44 --> | |
<div class="entry-modified-data"><?php the_modified_date('d/m/Y \à\s H\hi'); ?></div> |
This file contains hidden or 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 | |
/* | |
* WP MS Framework 1.0 | |
* Version 1.0 | |
* Developed By Manoj Singh | |
* Note: The another supported file is under-development | |
*/ | |
/* | |
[1] get_wp_ms_excerpt($content,$size); |
This file contains hidden or 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 | |
/** | |
* Display a list of the 10 most commented posts (WordPress) | |
* @author Corey Brown https://github.com/coreyweb | |
* @author Aaron Collegeman: https://github.com/collegeman | |
* @author Joey Blake: https://github.com/joeyblake | |
* | |
* Rules: | |
* - show a list of 10 posts | |
* - published any time |
This file contains hidden or 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 | |
echo flickr_feed('http://api.flickr.com/services/feeds/photos_public.gne?id=12345678@N06&format=json&nojsoncallback=1'); | |
function flickr_feed($url) { | |
$ch = curl_init($url); | |
curl_setopt($ch, CURLOPT_HEADER, 0); | |
curl_setopt($ch, CURLOPT_POST, 1); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
$output = curl_exec($ch); | |
curl_close($ch); |
NewerOlder