Skip to content

Instantly share code, notes, and snippets.

View ahaywood's full-sized avatar

Amy Haywood Dutton ahaywood

View GitHub Profile
@ahaywood
ahaywood / PHP: WP - Custom Wordpress Menu
Last active December 10, 2015 22:58
PHP: WP - Custom Wordpress Menu
<?php // CUSTOM WORDPRESS MENU
// IN FUNCTION.PHP
function register_menus() {
register_nav_menus(array(
'primary-menu' => __('Primary Menu')
));
}
add_action('init', 'register_menus');
// PLACE IN ACTUAL TEMPLATE
@ahaywood
ahaywood / PHP: WP - Insert Post Thumbnail
Last active December 10, 2015 22:58
PHP: WP - Insert Post Thumbnail
<?php
// INSERT POST THUMBNAIL
if ( has_post_thumbnail()) { $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large'); echo $thumbnail[0]; }
?>
@ahaywood
ahaywood / PHP: WP - Page Template
Last active December 11, 2015 07:48
PHP: WP - Page Template
<?php
/*
Template Name: Snarfer
*/
?>
@ahaywood
ahaywood / PHP: WP - Create widget section
Last active December 11, 2015 08:38
PHP: WP - Create widget section
// ADD TO FUNCTIONS.PHP
if (function_exists('register_sidebar')) {
register_sidebar(array(
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h5>',
'after_title' => '<h5>',
))
}
@ahaywood
ahaywood / CSS: Black and White Image
Last active December 11, 2015 08:48
CSS: Black and White Image
.black_and_white { filter: grayscale(100%); -webkit-filter: grayscale(100%); -moz-filter: grayscale(100%); -ms-filter: grayscale(100%); -o-filter: grayscale(100%); }
@ahaywood
ahaywood / CSS: Circle Image
Last active December 11, 2015 08:48
CSS: Circle Image
.circle { -webkit-border-radius: 50em; -moz-border-radius: 50em; -o-border-radius: 50em; border-radius: 50em; }
@ahaywood
ahaywood / PHP: WP - Child Theme
Last active December 11, 2015 12:58
PHP: WP - Child Theme
/*
Theme Name: Twenty Twelve Child
Theme URI: http://example.com/
Description: Child theme for the Twenty Twelve theme
Author: Your name here
Author URI: http://example.com/about/
Template: twentytwelve
Version: 0.1.0
*/
@ahaywood
ahaywood / PHP: WP - Generic Loop
Last active December 11, 2015 13:49
PHP: WP - Generic Loop
// WORDPRESS LOOP
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
<?php include (TEMPLATEPATH . '/inc/meta.php' ); ?>
<div class="entry">
@ahaywood
ahaywood / PHP: WP - Contact 7 Shortcode in PHP
Last active December 11, 2015 18:09
PHP: WP - Contact 7 Shortcode in PHP
<?php echo do_shortcode( '[contact-form-7 id="12" title="Contact Form"]' ); ?>
@ahaywood
ahaywood / CSS: Target iPad
Last active December 12, 2015 10:09
CSS: Target iPad
@media all and (device-width: 768px) and (device-height: 1024px) and (orientation:portrait) {
/* your css rules for ipad portrait */
}
@media all and (device-width: 768px) and (device-height: 1024px) and (orientation:landscape) {
/* your css rules for ipad landscape */
}