Skip to content

Instantly share code, notes, and snippets.

View rmorse's full-sized avatar

Ross Morsali rmorse

View GitHub Profile
@rmorse
rmorse / ellipsis.js
Created November 14, 2011 10:04 — forked from yuest/ellipsis.js
A Text Ellipsis jQuery Plugin For Firefox
// A jQuery plugin to enable the text ellipsis in firefox.
// see http://yue.st/notes/code/js/ellipsis.en.html
// usage:
// $('.elementsNeedEllipsis').ellipsis();
// the elements should be block level ('display: block' or 'display: inline-block')
//
// I think you should take care of resize event by yourself,
// just call $('.elem').ellipsis() again after element resized.
$.fn.ellipsis = function () {
$(this).css({'white-space': 'nowrap', 'overflow': 'hidden'});
@rmorse
rmorse / Wordpress RSS 2.0 image enclosure
Last active August 29, 2015 14:06 — forked from supermethod/Wordpress RSS 2.0 image enclosure
Updated to to use a specific custom image size, with no fall back - better to have no image instead
function feedFilter($query) {
if ($query->is_feed) {
add_filter('rss2_item', 'feedContentFilter');
}
return $query;
}
add_filter('pre_get_posts','feedFilter');
function feedContentFilter($item) {
@rmorse
rmorse / gist:4cdc47afe8ed8789faf6
Last active September 21, 2015 22:15
Search & Filter Pro - Display Results Using a Shortcode - shortcodes
[searchandfilter id="1428"]
[searchandfilter id="1428" show="results"]
@rmorse
rmorse / sf-pro-ajax-events.js
Last active December 8, 2022 22:16
Search & Filter Pro - Ajax Events
//detects the start of an ajax request being made
$(document).on("sf:ajaxstart", ".searchandfilter", function(){
console.log("ajax start");
});
//detects when the ajax request has finished and the content has been updated
// - add scripts that apply to your results here
$(document).on("sf:ajaxfinish", ".searchandfilter", function(){
console.log("ajax complete");
//so load your lightbox or JS scripts here again
@rmorse
rmorse / sf-pro-filter-sf-edit-query-args.php
Last active November 3, 2015 16:21
Search & Filter Pro - Filter - sf_edit_query_args
<?php
/*
Takes 2 paramaters -
$query_args - an array of query arguments - this is the same as teh `$args` variable that gets passed to to `WP_Query`- https://codex.wordpress.org/Class_Reference/WP_Query
$sfid - this is the numeric ID of the Search Form
Make sure to return $query_args after you have modified it as with all WP filters
*/
function sf_filter_query_args( $query_args, $sfid ) {
//if search form ID = 225, the do something with this query
@rmorse
rmorse / sf-pro-marketify-functions.php
Last active September 22, 2015 14:39
Search & Filter Pro - Marketify
<?php
//add this to functions.php and replace `14` with the ID of your search form
function search_filter_marketify_entry_before() {
do_action( 'search_filter_prep_query', 14 );
}
add_action( 'marketify_entry_before', 'search_filter_marketify_entry_before' );
?>
@rmorse
rmorse / sf-pro-active-query.php
Created September 22, 2015 17:47
Search & Filter Pro - Active Query
<?php
//grab the active query from our search form
//replace `1526` with the ID of your search form
global $searchandfilter;
$sf_current_query = $searchandfilter->get(1526)->current_query();
?>
@rmorse
rmorse / sf-pro-active-query-single-field.php
Created September 22, 2015 17:50
Search & Filter Pro - Active Query - Get a single field
<?php
//Get a single fields values using labels
//replace `1526` with the ID of your search form
global $searchandfilter;
$sf_current_query = $searchandfilter->get(1526)->current_query();
echo $sf_current_query->get_field_string("_sft_category");
?>
@rmorse
rmorse / sf-pro-active-query-multiple-fields.php
Last active March 9, 2017 19:09
Search & Filter Pro - Active Query - Get multiple fields by passing an array of field names
<?php
//Get a multiple fields values by passing an array of field names
//replace `1526` with the ID of your search form
global $searchandfilter;
$sf_current_query = $searchandfilter->get(1526)->current_query();
/*
* EXAMPLE 1
*/
@rmorse
rmorse / sf-pro-active-query-array-objects.php
Last active September 22, 2015 18:03
Search & Filter Pro - Active Query - Get array of objects contain all filter data
<?php
//Get an array of objects containing data for the current search/filter
//replace `1526` with the ID of your search form
global $searchandfilter;
$sf_current_query = $searchandfilter->get(1526)->current_query();
var_dump($sf_current_query->get_array());
?>