Skip to content

Instantly share code, notes, and snippets.

Avatar

Ross Morsali rmorse

View GitHub Profile
@rmorse
rmorse / ellipsis.js
Created Nov 14, 2011 — forked from yuest/ellipsis.js
A Text Ellipsis jQuery Plugin For Firefox
View ellipsis.js
// 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 Aug 29, 2015 — 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
View Wordpress RSS 2.0 image enclosure
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 Sep 21, 2015
Search & Filter Pro - Display Results Using a Shortcode - shortcodes
View gist:4cdc47afe8ed8789faf6
[searchandfilter id="1428"]
[searchandfilter id="1428" show="results"]
@rmorse
rmorse / sf-pro-ajax-events.js
Last active Jun 28, 2019
Search & Filter Pro - Ajax Events
View sf-pro-ajax-events.js
//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 Nov 3, 2015
Search & Filter Pro - Filter - sf_edit_query_args
View sf-pro-filter-sf-edit-query-args.php
<?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 Sep 22, 2015
Search & Filter Pro - Marketify
View sf-pro-marketify-functions.php
<?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 Sep 22, 2015
Search & Filter Pro - Active Query
View sf-pro-active-query.php
<?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 Sep 22, 2015
Search & Filter Pro - Active Query - Get a single field
View sf-pro-active-query-single-field.php
<?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 Mar 9, 2017
Search & Filter Pro - Active Query - Get multiple fields by passing an array of field names
View sf-pro-active-query-multiple-fields.php
<?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 Sep 22, 2015
Search & Filter Pro - Active Query - Get array of objects contain all filter data
View sf-pro-active-query-array-objects.php
<?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());
?>
You can’t perform that action at this time.