Skip to content

Instantly share code, notes, and snippets.

@jaybuys
jaybuys / woo-slider-content-filter.php
Last active August 25, 2017 00:41
Make WooSlider plugin show full HTML content instead of excerpts in slide layout. Place this code in your WordPress theme functions.php file.
<?php
add_filter( 'wooslider_slides_layout_html', 'wooslider_custom_content', 10, 3);
function wooslider_custom_content ( $content, $args, $post ) {
global $post;
$image = get_the_post_thumbnail( get_the_ID() );
if ( 'true' == $args['link_slide'] || 1 == $args['link_slide'] ) {
$wooslider_url = get_post_meta( get_the_ID(), '_wooslider_url', true );
@jaybuys
jaybuys / promo-rollover.js
Created December 10, 2013 18:20
Simple jQuery function to add rollover functionality to promo boxes. Adds/Removes an "over" class to the main container for CSS styling and has a click function so that the entire promo box will be clickable to the hyperlink housed inside.
$(function() {
// Promo rollovers
$('.promo').mouseover(function() {
$(this).addClass('over');
}).mouseout(function() {
$(this).removeClass('over');
}).click(function() {
location.href = $(this).find('a').attr('href');
});
});
@jaybuys
jaybuys / functions.php
Last active December 29, 2019 01:32
WordPress Visual Composer Mods
function vc_update_defaults() {
// Default single image to size "full"
$param = WPBMap::getParam( 'vc_single_image', 'img_size' );
$param['value'] = 'full';
vc_update_shortcode_param( 'vc_single_image', $param );
// Modify button 2 styles to use custom colors
$colors_arr = array(
__( 'Custom Color #1', 'js_composer' ) => 'custom_classname_1',
__( 'Custom Color #2', 'js_composer' ) => 'custom_classname_2'
@jaybuys
jaybuys / searchwp-custom-weight.php
Last active September 22, 2017 06:10
Functions for custom weighting in Search WP
/*
* SearchWP Filter - Join the postmeta table so we can grab the resource publication date to add weight to it later.
*/
function hnn_searchwp_query_main_join( $sql, $engine ) {
global $wpdb;
if (isset($_GET['test']) && $_GET['test'] == 'true') {
$meta_key = 'publication_date'; // the meta_key you want to order by
$sql = $sql . " LEFT JOIN {$wpdb->postmeta} ON {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '{$meta_key}'";
}
echo $sql . '<br/><br/>';