This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* easy-autocomplete | |
* jQuery plugin for autocompletion | |
* | |
* @author Łukasz Pawełczak (http://github.com/pawelczak) | |
* @version 1.3.5 | |
* Copyright License: | |
*/ | |
/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.easy-autocomplete { width: 100% !important; position: relative; | |
a { display: block; } | |
.easy-autocomplete input { float: none; | |
&:hover, &:focus { box-shadow: none; border: none; } | |
} | |
.easy-autocomplete-container { left: 0; right: 0; margin: 0 auto; position: absolute; width: 70%; z-index: 15; | |
ul { display: none; margin-top: 0; padding-bottom: 0; padding-left: 0; position: relative; top: -1px; background: $white; max-height:400px; overflow-x: hidden; overflow-y: auto; | |
li, .eac-category { display: block; | |
&.selected { cursor: pointer; } | |
div { display: block; font-weight: normal; word-break: break-word; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div> | |
<h2>Find a profile</h2> | |
<form class="searchProfile" action="#" method="post"> | |
<input class="form-control searchField" id="profileFinder" name="profileFinder"> | |
</form> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Easy Autocomplete Options | |
var options = { | |
url: "datafeed.json", | |
getValue: "searchfield", | |
list: { | |
match: { enabled: true }, | |
onShowListEvent: function() { | |
$("input[name='profileFinder']").on("input", mark); | |
} | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('rewrite_rules_array', 'mmp_rewrite_rules'); | |
function mmp_rewrite_rules($rules) { | |
$newRules = array(); | |
$newRules['expertise/(.+)/(.+)/(.+)/(.+)/(.+)/?$'] = 'index.php?expertise=$matches[5]'; // use the 5th tax segment | |
$newRules['expertise/(.+)/(.+)/(.+)/(.+)/?$'] = 'index.php?expertise=$matches[4]'; // use the 4th tax segment | |
$newRules['expertise/(.+)/(.+)/(.+)/?$'] = 'index.php?expertise=$matches[3]'; // use the 3rd tax segment | |
$newRules['expertise/(.+)/(.+)/?$'] = 'index.php?expertise=$matches[2]'; // use the 2nd tax segment | |
$newRules['expertise/(.+)/(.+)/?$'] = 'index.php?expertise_type=$matches[2]'; | |
$newRules['expertise/(.+)/?$'] = 'index.php?expertise_type=$matches[1]'; | |
return array_merge($newRules, $rules); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_taxonomy_parents($id, $taxonomy, $link = false, $separator = '/', $nicename = false, $visited = array()) { | |
$chain = ''; | |
$parent = &get_term($id, $taxonomy); | |
if (is_wp_error($parent)) { | |
return $parent; | |
} | |
if ($nicename) | |
$name = $parent -> slug; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function filter_post_type_link($link, $post) | |
{ | |
if ($post->post_type != 'expertise') | |
return $link; | |
if ($cats = get_the_terms($post->ID, 'expertise_type')) | |
{ | |
$link = str_replace('%expertise_type%', get_taxonomy_parents(array_pop($cats)->term_id, 'expertise_type', false, '/', true), $link); // see custom function defined below | |
} | |
return $link; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'init', 'create_expertise_type_taxonomies', 0 ); | |
function create_expertise_type_taxonomies() | |
{ | |
// Add new taxonomy, make it hierarchical => true for categories-like taxonomies) | |
$labels = array( | |
'name' => _x( 'Expertise', 'taxonomy general name' ), | |
'singular_name' => _x( 'Expertise', 'taxonomy singular name' ), | |
'search_items' => __( 'Search Expertise' ), | |
'all_items' => __( 'All Expertises' ), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Post type 'expertise' | |
add_action( 'init', 'create_expertise_post_type', 4 ); | |
function create_expertise_post_type() | |
{ | |
$labels = array( | |
'name' => __( 'Expertise' ), | |
'singular_name' => __( 'Expertise' ), | |
'add_new' => __( 'Add New' ), | |
'add_new_item' => __( 'Create New' ), | |
'edit' => __( 'Edit' ), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$query = array( | |
'post_type' => 'profiles', | |
'meta_query' => array( | |
'relation' => 'OR', | |
array( | |
'key' => 'disable_profile', | |
'compare' => '==', | |
'value' => 'disabled', | |
), | |
array( |