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 | |
/** | |
* 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 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 // show a random video from the last 10 posts in the video category | |
$vidCount = rand(0, 9); | |
$my_query = new WP_Query( | |
array( | |
"cat" => 11, | |
"showposts" => 1, | |
"offset" => $vidCount, | |
"post__not_in" => array($post->ID) // exclude the current post from the list |
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
LargeImage: | |
http://ecx.images-amazon.com/images/I/41jK517l%2BBL.jpg | |
MediumImage: (adds '._SL160_' to the LargeImage URL) | |
http://ecx.images-amazon.com/images/I/41jK517l%2BBL._SL160_.jpg | |
SmallImage: (adds '._SL75_' to the LargeImage URL) | |
http://ecx.images-amazon.com/images/I/41jK517l%2BBL._SL75_.jpg |
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
// Some custom styling examples | |
/* category pagination */ | |
.pagination { | |
margin: 0 0 10px 0; padding: 10px 0; border-top: 1px solid #ccc; | |
} | |
.page-numbers { | |
font-family:proxima-nova,Arial, Helvetica, sans-serif; | |
font-weight: normal; | |
font-size: 15px; | |
} |
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 | |
// place this in your theme's function.php file | |
function the_category_filter($thelist,$separator=' ') { | |
if(!defined('WP_ADMIN')) { | |
//list the category names to exclude | |
$exclude = array('Some Category','Another Category','Blah Blah Blah'); |
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 | |
// put this code in the theme's functions.php file | |
function trim_excerpt($text) { | |
return rtrim($text,'[...]'); | |
} | |
add_filter('get_the_excerpt', 'trim_excerpt') | |
?> |
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
ErrorDocument 404 /404.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
RewriteEngine On | |
RewriteCond %{HTTP_HOST} ^domain-name\.com | |
RewriteCond %{HTTPS} =on | |
RewriteRule .* https://www.%{SERVER_NAME}%{REQUEST_URI} [R,L] | |
RewriteCond %{HTTP_HOST} ^domain-name\.com | |
RewriteCond %{HTTPS} !=on | |
RewriteRule .* http://www.%{SERVER_NAME}%{REQUEST_URI} [R,L] |
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 | |
// Convert URL's with protocol prefix | |
$text = ereg_replace("[a-zA-Z]+://([-]*[.]?[a-zA-Z0-9_/-?&%])*", "<a href=\"\\0\">\\0</a>", $text); | |
//Convert URL with just www. | |
$text = ereg_replace("(^| |\n)(www([-]*[.]?[a-zA-Z0-9_/-?&%])*)", "\\1<a href=\"http://\\2\">\\2</a>", $text); | |
//Convert @ replies | |
$text = ereg_replace("(^| |\n)(\@([-]*[.]?[a-zA-Z0-9_/-?&%])*)", "\\1<a href=\"http://www.twitter.com/\\2\">\\2</a>", $text); | |
$text = str_replace("/@", "/", $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 | |
// Set the lowest & highest numeric point in you series names of your includes files - example here is 1 and 4 | |
$sl = rand(1,4); | |
echo $sl; | |
?> |