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 | |
echo '<pre>'; | |
echo '<span style="color:blue">DOWNLOADING...</span>'.PHP_EOL; | |
// Download file | |
file_put_contents('wp.zip', file_get_contents('https://wordpress.org/latest.zip')); | |
$zip = new ZipArchive(); | |
$res = $zip->open('wp.zip'); | |
if ($res === TRUE) { |
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 leet = { | |
/** | |
* Map of conversions. | |
* | |
* @var object | |
*/ | |
characterMap: { | |
'a': '4', | |
'b': '8', |
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
# Setting "expires" tells browsers downloading these files that | |
# they don't need to request it again for this specific length of | |
# time. In otherwords, use the cache instead if you have it. This | |
# can reduce stress on the server for you, and speed up page load | |
# time for visitors. | |
# BEGIN EXPIRES | |
<IfModule mod_expires.c> | |
ExpiresActive On | |
ExpiresDefault "access plus 10 days" |
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 | |
/* | |
Plugin Name: Wptuts+ Favorite Plugins | |
Plugin URI: http://wp.tutsplus.com/tutorials/plugins/building-the-favorite-plugins-plugin/ | |
Description: Quickly and easily access and install your favorited plugins from WordPress.org, right from your dashboard. | |
Version: 0.7 | |
Author: Japh | |
Author URI: http://wp.tutsplus.com/author/japh | |
License: GPL2 | |
*/ |
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 a.ID, a.post_title, a.post_type, a.post_status | |
FROM wp_posts AS a | |
INNER JOIN ( | |
SELECT post_title, MIN( id ) AS min_id | |
FROM wp_posts | |
WHERE post_type = 'post' | |
AND post_status = 'publish' | |
GROUP BY post_title | |
HAVING COUNT( * ) > 1 | |
) AS b ON b.post_title = a.post_title |
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
<div class="the-return"> | |
[HTML is replaced when successful.] | |
</div> |
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 | |
/* | |
Plugin Name: WP_Rewrite endpoints demo | |
Description: A plugin giving example usage of the WP_Rewrite endpoint API | |
Plugin URI: http://make.wordpress.org/plugins/2012/06/07/rewrite-endpoints-api/ | |
Author: Jon Cave | |
Author URI: http://joncave.co.uk/ | |
*/ | |
function makeplugins_endpoints_add_endpoint() { |
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 example_ajax_enqueue() { | |
// Enqueue javascript on the frontend. | |
wp_enqueue_script( | |
'example-ajax-script', | |
get_template_directory_uri() . '/js/simple-ajax-example.js', | |
array( 'jquery' ) | |
); |
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 | |
$file = '/path/to/file.png'; | |
$filename = basename($file); | |
$upload_file = wp_upload_bits($filename, null, file_get_contents($file)); | |
if (!$upload_file['error']) { | |
$wp_filetype = wp_check_filetype($filename, null ); | |
$attachment = array( | |
'post_mime_type' => $wp_filetype['type'], | |
'post_parent' => $parent_post_id, |
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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteRule ^index\.php$ - [L] | |
RewriteRule (.*) ./index.php?id=$1 [L] | |
</IfModule> |