Skip to content

Instantly share code, notes, and snippets.

View jeremyjaymes's full-sized avatar

Jeremy jeremyjaymes

View GitHub Profile
@jeremyjaymes
jeremyjaymes / hugo_seo.html
Last active March 21, 2021 08:39
Hugo SEO Markup
<meta name="description" content="{{ if .IsHome }}{{ .Site.Params.description }}{{ else }}{{ .Description }}{{ end }}"/>
<meta name="robots" content="noodp"/>
<link rel="canonical" href="{{ .Permalink }}" />
<!-- Twitter Card -->
<meta name="twitter:card" content="summary" />
<meta name="twitter:description" content="{{ if .IsHome }}{{ .Site.Params.description }}{{ else }}{{ .Description }}{{ end }}" />
<meta name="twitter:title" content="{{ .Title }}{{ if .IsHome }} - {{ .Site.Params.Tagline }}{{ else }} - {{ .Site.Title }}{{ end }}" />
<meta name="twitter:site" content="{{ .Site.Params.twitter }}" />
<meta name="twitter:creator" content="{{ .Site.Params.twitter }}" />
<?php
/**
* Slides Custom Post Type
*
* Register a slides custom post type for those that insist.
* Useful when slides don't belong as posts or pages. Can be used with
* a plugin, e.g. Genesis Responsive Slider or a custom implementation.
*
* Does not currently include post content, only the excerpt.
*/
@jeremyjaymes
jeremyjaymes / gist:8b6a9fd5dcd568a3c875
Last active August 29, 2015 14:21
Gruntfile.js for Genesis (Replace style.css)
module.exports = function(grunt) {
require('jit-grunt')(grunt);
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
cssmin: {
options: {
shorthandCompacting: false,
roundingPrecision: -1
@jeremyjaymes
jeremyjaymes / gist:59fbb68397a6353de9ad
Created November 13, 2014 18:43
Anchor Link from Genesis Custom Post Class
## Using Genesis custom post class to set up anchor links
## See http://jeremyjaymes.com/anchor-links-genesis-custom-post-class
# Step 1 Open first custom query
# i.e. $my-query->the_post();
<div class="person">
<a href="#' . genesis_get_custom_field( '_genesis_custom_post_class' ) . '">Headshot</a>
</div>
@jeremyjaymes
jeremyjaymes / template-sidebar.php
Last active August 29, 2015 14:07
Add Genesis Sidebar area to Custom Post Template
<?php
/**
* Opening PHP tag is likely not needed
* Functions are added to our custom single post template
*/
//* Hook our sidebar logic to get_header
add_action( 'get_header', 'mytheme_sidebar_function' );
//* Remove the primary sidebar, swap in our custom sidebar
@jeremyjaymes
jeremyjaymes / register-genesis-sidebar.php
Last active August 29, 2015 14:07
Register New Genesis Sidebar
<?php
//* Don't include opening php tag, this will go in your functions.php
//* Register a new sidebar
genesis_register_sidebar( array(
'id' => 'custom-post-sidebar',
'name' => __( 'Custom Post - Sidebar', 'my-theme' ),
'description' => __( 'Widget area on all single custom post pages.', 'my-theme' ),
) );
@jeremyjaymes
jeremyjaymes / filetype-extension.php
Last active October 4, 2021 06:38
WordPress Get Attachment File Type Extension
<?php
/**
* Get attachment file type extension
*
* Requires that you have the attachment id
* See this post http://jeremyjaymes.com/display-attach…ordpress-theme/ for more explanation
*/
//* Assumes we're in a loop and have our attachment id already
$file_url = wp_get_attachment_url( $file_id );
@jeremyjaymes
jeremyjaymes / tax-id-column.php
Last active August 29, 2015 14:02
Custom "Tax ID" Column for WordPress Admin Columns
//* Show the taxonomy ID
add_filter( "manage_edit-my_tax_columns", 'my_add_col' );
add_filter( "manage_edit-my_tax_sortable_columns", 'my_add_col' );
add_filter( "manage_my_tax_custom_column", 'my_tax_id', 10, 3 );
function my_add_col( $new_columns ) {
$new_columns = array(
'cb' => '<input type="checkbox" />',
'name' => __('Name'),
@jeremyjaymes
jeremyjaymes / image-microdata
Last active December 10, 2017 14:47
Add Microdata to WordPress Thumbnails
/**
* Add microdata to WordPress thumbnails
*/
//* Using the_post_thumbnail
the_post_thumbnail( 'image-size', array( 'itemprop' => 'Photo' ) );
//* Using get_the_post_thumbnail
get_the_post_thumnail( 'image-size', array( 'itemprop' => 'Photo' ) );
@jeremyjaymes
jeremyjaymes / node-term.tpl.php
Created April 27, 2012 11:43
Node Term Template
<?php
/**
* Node-term.tpl function
* Add this to your theme's template.php, replace "mytheme" with your theme's name
*/
function mytheme_preprocess_node(&amp;$vars) {
foreach ($vars['node']->taxonomy as $term) {
$vars['template_files'][] = 'node-term-'. $term->tid;
}
}