Skip to content

Instantly share code, notes, and snippets.

@scottwebb
scottwebb / functions.php
Last active December 11, 2015 10:28
add to functions.php to set up a new custom field that allows for image crop alignment.
// Add Image Crop Alignment to Custom Field
function woo_metaboxes_add($woo_metaboxes) {
if ( ( get_post_type() == 'portfolio') || ( !get_post_type() ) ) {
$woo_metaboxes[] = array ( "name" => "_image_alignment",
"std" => "Center",
"label" => "Image Crop Alignment",
"type" => "select2",
"desc" => "Select crop alignment for resized image",
@scottwebb
scottwebb / add to functions.php
Created January 19, 2013 03:58
Change the 4 to the tag ID of the video category.
// Custom Query Filter to remove video tag posts from blog
add_action('pre_get_posts', 'woo_custom_query_filter' );
function woo_custom_query_filter( $query ) {
if ($query->is_page_template('template-blog.php') && $query->is_main_query() ) {
$query->set('tag__not_in','4');
$query->parse_query();
}
add_action( 'woo_loop_before', 'wooninja_custom_home_wooslider');
function wooninja_custom_home_wooslider () {
if ( is_front_page() && !is_paged() ) {
echo do_shortcode('[wooslider slider_type="slides"]');
} // END IF
} // End woo_custom_display_page_content()
@scottwebb
scottwebb / add to functions.php
Created January 15, 2013 16:29
This is to display the featured slider on a static front page for the Function Theme by WooThemes
/*-----------------------------------------------------------------------------------*/
/* Add Featured Slider to static Front Page */
/*-----------------------------------------------------------------------------------*/
remove_action( 'woo_main_before', 'woo_featured_slider_loader' );
add_action( 'woo_main_before', 'woo_custom_featured_slider_loader' );
function woo_custom_featured_slider_loader () {
21if ( is_front_page()) {
get_template_part( 'includes/featured', 'slider' );
@scottwebb
scottwebb / add to functions.php
Last active December 10, 2015 19:58
Portfolio Gallery Breadcrumbs in Canvas
/*-----------------------------------------------------------------------------------*/
/* Add the full portfolio gallery hierarchy to the breadcrumb trail */
/*-----------------------------------------------------------------------------------*/
add_filter( 'woo_breadcrumbs_trail', 'woo_custom_breadcrumbs_trail_add_portfolio_galleries', 10 );
function woo_custom_breadcrumbs_trail_add_portfolio_galleries ( $trail ) {
if ( ( get_post_type() == 'portfolio' ) && is_singular() ) {
global $post;
@scottwebb
scottwebb / fblike permalink
Created December 28, 2012 19:24
This is the using the facebook like shortcode but using the url attribute to link to the specific post the like button is for. Good for the index or archives so that you are not simply liking the home url/archives url/blog url.
@scottwebb
scottwebb / functions.php
Created December 4, 2012 02:06
add welcome to woo_main_before hook
add_action('woo_main_before', 'wooninja_add_homepage_welcome');
function wooninja_add_homepage_welcome() {
if (is_front_page()) { ?>
<h3>Welcome to My Site</h3>
<?php
} // END IF
} // END wooninja_add_homepage_welcome()
// Custom Query Filter
add_action('pre_get_posts', 'woo_custom_query_filter' );
function woo_custom_query_filter( $query ) {
if ($query->is_front_page() && $query->is_main_query() ) {
$query->set('category__in','25');
$query->parse_query();
}
// Custom Query Filter
add_action('pre_get_posts', 'woo_custom_query_filter' );
function woo_custom_query_filter( $query ) {
if ($query->is_front_page() && $query->is_main_query() ) {
$query->set('posts_per_page','4');
$query->parse_query();
}
@scottwebb
scottwebb / functions.php
Created November 11, 2012 15:54
customize the text for archive title for tags
add_filter( 'woo_archive_title', 'custom_archive_title', 2 );
function custom_archive_title( $title) {
if ( is_tag() ) {
$title = '<span class="fl cat">' . __( 'Custom', 'woothemes' ) . ' | ' . single_cat_title( '', false ) . '</span> <span class="fr catrss">';
}
return $title;
}