Skip to content

Instantly share code, notes, and snippets.

View rachelbaker's full-sized avatar

Rachel Baker rachelbaker

View GitHub Profile
@rachelbaker
rachelbaker / WordPress-taxonomy-custom-display
Created October 14, 2011 20:10
Display WordPress Custom Taxonomy in Template without Link
<strong>Industry:</strong><?php $pc_industry = wp_get_post_terms( $post->ID,'industry', $args ) ; print($pc_industry[0]->name);?><br />
@rachelbaker
rachelbaker / wordpress-htaccess-rackspace-sites
Created October 20, 2011 19:46
Rackspace Cloud .htaccess file fixes for WordPress
# PHP Site Settings for Rackspace Cloud Sites
php_value max_execution_time 3600
php_value upload_max_filesize 100M
php_value post_max_size 220M
php_value memory_limit 256M
# End PHP Site Settings
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
@rachelbaker
rachelbaker / wordpress-post-formats-icon-code
Created October 26, 2011 15:06
Post Formats Icon Code
<?php
if ( has_post_format( 'aside' )) {
echo '<img class="post-icon"';
echo 'src="';
echo bloginfo('template_url');
echo '/images/post-format-aside.png" alt="Aside Post" />';
}
elseif ( has_post_format( 'image' )) {
echo '<img class="post-icon"';
echo 'src="';
@rachelbaker
rachelbaker / post-formats-loop-output
Created October 26, 2011 15:08
WordPress Post Formats Loop Output
<article class="post-1242 post type-post status-publish format-link hentry category-wordpress-2" id="post-1242">
<div class="post-content">
<header>
<img class="post-icon" src="/images/post-format-link.png?9d7bd4" alt="Link Post">
<h2>POST TITLE</h2>
@rachelbaker
rachelbaker / baseline-css
Created October 28, 2011 18:21
Baseline CSS: Graph paper like background for easier alignment of elements
html {
font-size: 93.8%;
background-color: #f1f2f3;
background-image:
-webkit-linear-gradient(0deg, transparent .05em, rgba(0,0,0,.05) .05em, rgba(0,0,0,.05) .125000em, transparent .125000em),
-webkit-linear-gradient(rgba(0,0,0,.05) .062500em, transparent .062500em);
background-image:
-moz-linear-gradient(0deg, transparent .05em, rgba(0,0,0,.05) .05em, rgba(0,0,0,.05) .125000em, transparent .125000em),
-moz-linear-gradient(rgba(0,0,0,.05) .062500em, transparent .062500em);
background-image:
@rachelbaker
rachelbaker / wordpress-recent-posts-dashboard-widget.php
Created November 29, 2011 14:14
Add 5 Most Recent Posts to WordPress Dashboard
function rb_recent_posts_dashboard() {
?>
<ol>
<?php
global $post;
$args = array( 'numberposts' => 5 );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<li> (<? the_date('Y / n / d'); ?>) <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
@rachelbaker
rachelbaker / wp-custom-login-logo.php
Created January 5, 2012 16:41
WordPress Custom Login Logo Function
// Custom login logo for wp-admin screen //
function pic_custom_login_logo() {
echo '<style type="text/css">
h1 a { background-image:url('.get_bloginfo('template_directory').'/images/login-logo.png) !important; }
</style>';
}
add_action('login_head', 'pic_custom_login_logo');
@rachelbaker
rachelbaker / display-latest-twitter-tweets.php
Created January 12, 2012 21:59
Display Latest Tweets Function - uses curl to fetch json timeline
// replace $username= with correct username
function rb_latest_tweet($username = 'rachelbaker', $include_date = true){
$twitter_feed_url = "https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=0&screen_name=$username&count=3"; // will show 3 most recent tweets, can change value if needed //
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $twitter_feed_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$alltweets = curl_exec($ch);
@rachelbaker
rachelbaker / wordpress-testimonial-widget.php
Created January 26, 2012 18:20
WordPress Testimonial Widget - adds custom widget to WordPress Widget Dashboard
/**
* Creating custom Testimonial Widget Area
*/
class Testimonial_Widget extends WP_Widget {
function Testimonial_Widget() {
$widget_ops = array('classname' => 'testimonial_sidebar_widget', 'description' => 'Custom Testimonial Widget' );
$this->WP_Widget('testimonial_widget', 'Testimonial Widget', $widget_ops);
}
function widget($args, $instance) {
extract($args, EXTR_SKIP);
@rachelbaker
rachelbaker / wordpress-excerpt-functions.php
Created January 26, 2012 19:50
WordPress Excerpt Related Functions from TwentyTen Theme
<?php
/**
* Sets the post excerpt length to 40 characters.
*/
function twentyten_excerpt_length( $length ) {
return 40;
}
add_filter( 'excerpt_length', 'twentyten_excerpt_length' );
/**