Skip to content

Instantly share code, notes, and snippets.

View j-gardner's full-sized avatar

John Gardner j-gardner

View GitHub Profile
@j-gardner
j-gardner / functions.php
Last active August 16, 2016 15:39
Add Category Support to FAQ Post Type
<?php
// Add the following to your theme's functions.php file
add_action( 'plugins_loaded', 'add_categories_to_cpt', 15 );
function add_categories_to_cpt(){
register_taxonomy_for_object_type( 'category', 'faq');
// 'faq' can be changed to any registered post type
}
<?php
$cpt = new Arconix_CPT_Register();
$cpt->add( 'books' );
$tax = new Arconix_Taxonomy_Register();
$tax->add( 'genres', 'books' );
@j-gardner
j-gardner / gist:ce417c886a29163018edada999f9c12c
Last active June 26, 2016 23:50
Change the FontAwesome version (add to your theme's functions.php file)
<?php // DO NOT include the opening php tag
// Replace 4.6.0 with whatever version you'd like
add_filter( 'arconix_fontawesome_version', '4.6.0' );
@j-gardner
j-gardner / gist:0f3adc735eb9ec7b5b39
Last active August 29, 2015 14:06
Add the googlemap shortcode back
<?php // DO NOT include the opening php tag
add_filter( 'arconix_shortcodes_list', 'add_gmap' );
function add_gmap( $list ) {
$list[] = 'googlemap';
return $list;
}
@j-gardner
j-gardner / gist:4f5abb3350a9a585bad3
Created September 6, 2014 12:29
Code Shortcode example
[code]get_the_content()[/code]
@j-gardner
j-gardner / gist:10928035
Created April 16, 2014 20:11
Add post tags support to a custom post type (in this case "portfolio")
<?php
/**
* Adds Post Tag support to a custom post type.
*
* This code is set to work with Arconix Portfolio, however
* the code should work with any of my plugins, simply
* change the 1st filter argument to match, i.e.
* 'arconix_testimonials_defaults' as I structure my
* defaults pretty much the same across all my plugins
*/
@j-gardner
j-gardner / gist:10469315
Last active August 29, 2015 13:59
Exclude Additional Post Types from the Arconix Flexslider widget select box
<?php
// In your theme's functions.php file
// To add 1 post type to the exclude list
add_filter( 'arconix_flexslider_exclude_post_types', 'exclude_pt' );
function exclude_pt( $post_types ) {
$post_types[] = 'post_type_name';
return $post_types;
@j-gardner
j-gardner / gist:10437717
Created April 11, 2014 02:25
Add a requirement that only items which have a featured image should be returned
<?php
// In your theme's functions.php file
add_filter( 'arconix_flexslider_loop_args', 'thumbnail_meta' );
function thumbnail_meta( $args ) {
$args['meta_key'] = "_thumbnail_id";
return $args;
}
@j-gardner
j-gardner / gist:9499412
Last active August 29, 2015 13:57
Modify portfolio image links to open them in new windows
jQuery(document).ready( function(){
jQuery( "ul.arconix-portfolio-grid a.portfolio-image" ).attr( 'target', '_blank' );
});
@j-gardner
j-gardner / gist:6529691
Last active December 22, 2015 20:59
Add Comment support to the Portfolio CPT
<?php // DO NOT include the opening php tag
add_action( 'init', 'arconix_post_type_supports' );
function arconix_post_type_supports() {
add_post_type_support( 'portfolio', 'comments' );
}