Skip to content

Instantly share code, notes, and snippets.

@sharpmachine
sharpmachine / anchor.html
Last active August 29, 2015 14:01
Smooth page scrolling for anchors
<!-- Call -->
<a href="#branding">Branding</a>
<!-- Anchor -->
<div id="branding" class="anchor"></div>
@sharpmachine
sharpmachine / gist:a0a50ec6c2a37aabc3a8
Last active August 29, 2015 14:01
Query Custom Post Types
<?php $args = array( 'post_type' => 'lastest_updates', 'showposts' => 1); ?>
<?php $latest_updates = new WP_Query( $args ); ?>
<?php if ( $latest_updates->have_posts() ) : ?>
<?php while ( $latest_updates->have_posts() ) : $latest_updates->the_post(); ?>
<?php the_short_title(35); ?> <a href="<?php the_permalink(); ?>" class="read-more">Read More &#8594;</a>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
@sharpmachine
sharpmachine / acf_rows.php
Created May 29, 2014 22:20
AFC rows and subfields
<?php if(get_field('team_members')): ?>
<?php while(has_sub_field('team_members')): ?>
<div class="row team-member">
<div class="col-sm-4">
<img src="<?php the_sub_field('team_member_headshot'); ?>" class="img-responsive img-circle" alt="<?php the_sub_field('team_member_name'); ?>">
</div>
<div class="col-sm-8">
<h3 class="team-member-name"><?php the_sub_field('team_member_name'); ?></h3>
<div class="team-member-position"><?php the_sub_field('team_member_title'); ?></div>
@sharpmachine
sharpmachine / current_tax.php
Created June 3, 2014 00:09
Get the Current Taxonomy of the Post using get_the_terms in WordPress
?php $terms = get_the_terms( $post->ID , 'Taxonomy Name' );
foreach ( $terms as $term ) {
$term_link = get_term_link( $term, 'Taxonomy Name' );
echo "<a href='".$term_link."'>" . $term->name . "</a>, ";
} ?>
@sharpmachine
sharpmachine / .htaccess
Created July 2, 2014 15:00
Increase upload size via .htaccess
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300
@sharpmachine
sharpmachine / gist:5175fcd40ee5baa6e783
Created July 3, 2014 19:11
Copy ssh key to server
cat ~/.ssh/id_rsa.pub | ssh user@machine "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"
// http://stackoverflow.com/questions/18432577/stacked-tabs-in-bootstrap-3
.tabs-below, .tabs-right, .tabs-left {
.nav-tabs {
border-bottom: 0;
}
}
.tab-content > .tab-pane,
.pill-content > .pill-pane {
display: none;
@sharpmachine
sharpmachine / model.rb
Last active August 29, 2015 14:07
Capture screenshot and store it to Amazon s3 - via Carrierwave, Fog and Phantomjs
class Model < ActiveRecord::Base
before_save :website_screenshot
mount_uploader :screenshot, ScreenshotUploader
def website_screenshot
file = 'app/assets/images/website_screenshot.png'
system 'phantomjs app/assets/javascripts/vendors/rasterize.js ' + website + ' ' + file
self.screenshot = File.open(File.join(Rails.root, file))
end
end
@sharpmachine
sharpmachine / template-kitchen-sink.php
Created January 27, 2015 19:25
Kitchen Sink Template
<?php
/*
* Template Name: Kitchen Sink
*/
?>
<div class="container">
<h1>Theme</h1>
<p class="lead">Possible global CSS settings adopted from Bootstrap. Just add the HTML for whichever global CSS settings are needed, then style it. The most common are included already.</p>
@sharpmachine
sharpmachine / kitchensink.php
Last active August 29, 2015 14:14 — forked from jaymiejones86/bootstahp.html
A kitchen sink for styling components
<?php
/*
* Template Name: Component Kitchen Sink
*/
?>
<html>
<head>
<title>White Plum Kitchen Sink - Bootstrap 3 Theme</title>