Skip to content

Instantly share code, notes, and snippets.

Avatar

John Gardner j-gardner

  • Rhode Island
View GitHub Profile
@j-gardner
j-gardner / functions.php
Last active Aug 16, 2016
Add Category Support to FAQ Post Type
View functions.php
<?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
}
View example.php
<?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 Jun 26, 2016
Change the FontAwesome version (add to your theme's functions.php file)
View gist:ce417c886a29163018edada999f9c12c
<?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 Aug 29, 2015
Add the googlemap shortcode back
View gist:0f3adc735eb9ec7b5b39
<?php // DO NOT include the opening php tag
add_filter( 'arconix_shortcodes_list', 'add_gmap' );
function add_gmap( $list ) {
$list[] = 'googlemap';
return $list;
}
View gist:4f5abb3350a9a585bad3
[code]get_the_content()[/code]
@j-gardner
j-gardner / gist:10928035
Created Apr 16, 2014
Add post tags support to a custom post type (in this case "portfolio")
View gist:10928035
<?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 Aug 29, 2015
Exclude Additional Post Types from the Arconix Flexslider widget select box
View gist:10469315
<?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 Apr 11, 2014
Add a requirement that only items which have a featured image should be returned
View gist:10437717
<?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 Aug 29, 2015
Modify portfolio image links to open them in new windows
View gist:9499412
jQuery(document).ready( function(){
jQuery( "ul.arconix-portfolio-grid a.portfolio-image" ).attr( 'target', '_blank' );
});
@j-gardner
j-gardner / gist:6529691
Last active Dec 22, 2015
Add Comment support to the Portfolio CPT
View gist:6529691
<?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' );
}
You can’t perform that action at this time.