Skip to content

Instantly share code, notes, and snippets.

Avatar

Ross Morsali rmorse

View GitHub Profile
@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-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-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-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());
?>
@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 / sf-pro-get-active-search-form.php
Last active Oct 11, 2015
Search & Filter Pro - Get the Active Search Form
View sf-pro-get-active-search-form.php
<?php
//check if a form is active
global $searchandfilter;
if($searchandfilter->active_sfid())
{
//a valid search form exists
}
else
{
//returns false if none is found
@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-active-query-is-filtered.php
Created Jan 20, 2016
Search & Filter Pro - Active Query - Check to see if a user has selected any filters
View sf-pro-active-query-is-filtered.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();
echo $sf_current_query->is_filtered();
?>
View basic-archive-template-test.php
<?php get_header(); ?>
<section id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php if ( have_posts() ) : ?>
<?php
You can’t perform that action at this time.