Skip to content

Instantly share code, notes, and snippets.

<script>
// LISTING DETAIL PAGE TABS
var tabs = $j('.cd-tabs');
tabs.each(function(){
var tab = $j(this),
tabItems = tab.find('ul.cd-tabs-navigation'),
tabContentWrapper = tab.children('ul.cd-tabs-content'),
tabNavigation = tab.find('nav');
tabItems.on('click', 'a', function(event){
function showBeforeMore($fullText){
$more = '<!--more-->';
if(strpos($fullText, $more)!==false){
$morePos = strpos($fullText, $more);
$rest = str_replace($more, '', $morePos);
//only show the text before the <!--more-->
@nixonmedia
nixonmedia / idxwidget.php
Last active April 5, 2018 12:39
IDXwidget
<?php
$agent_id = get_field('idx_ID');
echo do_shortcode('[impress_property_showcase property_type="featured" agent_id="'.$agent_id.'" show_image="1" use_rows="1" num_per_row="3" max="12" order="low-high" styles="1" new_window="0" ]');
?>
@nixonmedia
nixonmedia / buttoninjection.js
Last active April 5, 2018 12:43
Button Injection
$ = jQuery;
$(document).ready(function(){
$('.impress-showcase-property').each(function(){
href = $('.impress-showcase-photo', this).attr('href');
height = $(this).css('height');
$(this).append($('<a class="view-property-btn" href="'+href+'">View Property</a>'));
foreach ($entries as $entry){
$xmlstr = <<<XML
<?xml version='1.0' encoding='UTF-8'?>
<complaints></complaints>
XML;
$complaints = new SimpleXMLElement($xmlstr);
<?php
$output = array();
if(isset($med_sciences) && $med_sciences[0]=="Y"){
array_push($output , 'Medical Sciences');
}
if(isset($food_ag) && $food_ag[0]=="Y"){
<?php
$output = '';
$fields = wcf_get_form_search_values($id);
$settings = wcf_get_form_search_settings($id);
$columns = $settings['columns_per_row'] != '' ? $settings['columns_per_row'] : 3;
$template_loop = 'wcf-loop';
if ($settings['search_type'] == 'single') {
if (!post_type_exists($settings['post_type'][0])) {
return __('The post type: ' . $settings['post_type'] .' doesn\'t existing', WORDPRESS_CONTENT_FILTER_LANG);
function resortbrands($a,$b){
$a = preg_replace('/(\*|\.){2,}/', '$1', $a);
$b = preg_replace('/(\*|\.){2,}/', '$1', $b);
return strcmp($a,$b);
}
uasort($package, 'resortbrands');
<?php
function clean($string) {
return str_replace('*', '', $string);
}
function sortMyThings($things) {
uasort($things, function($left, $right) {
$left = strtoupper(clean($left['name']));
$right = strtoupper(clean($right['name']));
<?php
$grouped = [];