Skip to content

Instantly share code, notes, and snippets.

View rmorse's full-sized avatar

Ross Morsali rmorse

View GitHub Profile
@rmorse
rmorse / basic-archive-template-test.php
Created February 2, 2016 12:23
Basic Archive Template Test
<?php get_header(); ?>
<section id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php if ( have_posts() ) : ?>
<?php
@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-get-active-search-form.php
Last active October 11, 2015 21:03
Search & Filter Pro - Get the Active Search Form
<?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 / 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 / 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());
?>
@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-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 / 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 / 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) {