Skip to content

Instantly share code, notes, and snippets.

View melissacabral's full-sized avatar

Melissa Cabral melissacabral

View GitHub Profile
@melissacabral
melissacabral / glassbutton.css
Last active December 11, 2015 16:59
Glass Button CSS3 Demo for iw104
.glass {
display:inline-block;
margin:10px;
background-color:rgba(216,216,216,.07);
border:solid 1px rgba(0,0,0,.2);
padding:9px;
-webkit-border-radius: 50px;
border-radius: 50px;
-webkit-box-shadow: inset 0px 4px 4px 0px rgba(0, 0, 0, .3);
box-shadow: inset 0px 4px 4px 0px rgba(0, 0, 0, .3);
@melissacabral
melissacabral / search.php
Last active December 12, 2015 05:48
Blog Search for wp310 class day 13/14
<?php
//Configuration
$perpage = 5; //number of results to show per page
$pagenum = 1; // set the starting page number
//what phrase did they search for?
$phrase = $_GET['phrase'];
//get all posts and comments that are similar to the query, make sure the posts are distinct
$query_search = "SELECT distinct *
@melissacabral
melissacabral / add-theme-support.php
Last active December 14, 2015 13:19
Activate sleeping features of wordpress themes
<?php
//turn on tumblr-style post formats
add_theme_support('post-formats', array('image', 'video', 'audio', 'quote', 'gallery'));
//adds ability to have one featured image per post or page
add_theme_support('post-thumbnails');
//more robust feed links on every page
add_theme_support('automatic-feed-links');
@melissacabral
melissacabral / wp-comment-reply.php
Last active December 14, 2015 13:19
Improves UX when replying to threaded comments. use in functions.php
<?php
function awesome_comment_reply(){
if( !is_admin() &amp;&amp; is_singular() &amp;&amp; comments_open() &amp;&amp; get_option('thread_comments') ):
wp_enqueue_script( 'comment-reply' );
endif;
}
add_action( 'wp_print_scripts', 'awesome_comment_reply' );
@melissacabral
melissacabral / wp-functions-excerpts.php
Last active December 14, 2015 13:28
improve wordpress excerpts
<?php
//change the default (55 words) length of excerpts to 20 words
function new_ex_length($length) {
return 20;
}
add_filter('excerpt_length', 'new_ex_length', 999);
//changes the [...] to a button when excerpt content is truncated
function new_excerpt_more($more) {
$readmore = 'Read More';
@melissacabral
melissacabral / wp-register-widget.php
Last active December 14, 2015 13:28
Adds 4 wordpress "sidebars" or widget areas. Use in theme functions.php
<?php
/**
* Set up Widget Areas (Dynamic Sidebars)
*/
register_sidebar( array(
'name' => 'Home Features',
'description' => 'An area near the bottom of the home page',
'id' => 'home-features',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
@melissacabral
melissacabral / wp-login.php
Last active December 14, 2015 13:28
wordpress login form. place anywhere in your theme templates to display the form
<?php
//show the form if the user is not logged in
if( !is_user_logged_in() ):
wp_login_form();
else:
$redirect = home_url();
echo '<a href="'.wp_logout_url( $redirect ).'">Log Out</a>';
endif;
?>
@melissacabral
melissacabral / editor-style.css
Last active December 16, 2015 03:09
editor style for awesomeco
@import url(http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,700);
/*
== meyer reset
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
@melissacabral
melissacabral / wp-admin-table-markup.html
Created April 30, 2013 18:17
Wordpress Admin Panel Markup starter
<table class="form-table">
<tbody>
<tr valign="top">
<th scope="row">
<label>Option 1</label>
</th>
<td>
INPUT 1
</td>
</tr>
@melissacabral
melissacabral / anthill-visual-tile.html
Created May 4, 2013 00:27
use for tiles with an image
<article class="tile cf graphic-design @TODO PUT WORDPRESS POST_CLASS HERE">
<div class="resource-image thumbnail">
<a href="PERMALINK">
<img src="http://placekitten.com/352/198" alt="TITLE" />
</a>
<div class="popularity"><a href="#"><i class="icon-heart"></i></a> 9999</div>
<div class="category-icon"> <a href="CATEGORY ARCHIVE"><i class="icon-magic"></i></a> </div>
</div>
<h3 class="entry-title"><a href="PERMALINK">TITLE OF RESOURCE</a></h3>