Skip to content

Instantly share code, notes, and snippets.

View pije76's full-sized avatar

panjianom pije76

View GitHub Profile
First, add some CSS to your theme:
.facetwp-template { display: none; }
.facetwp-template.visible { display: block; }
Then you can use this JS to dynamically add the CSS class after the first refresh:
(function($) {
@pije76
pije76 / gist:4774bafdb2a005508c1dd143ee594bc6
Created July 22, 2019 13:55 — forked from CoachBirgit/gist:f1b94ccb22dc8d653fa3
Ultimate Member Private Messages: dynamic message button by passing dynamic user ID
<?php echo do_shortcode('[ultimatemember_message_button user_id='.$user_id.']'); ?>
@pije76
pije76 / custom-hooks.php
Created July 18, 2019 13:28 — forked from djrmom/custom-hooks.php
facetwp uncheck parent checkbox
<?php
/** uncheck the parent when checking a child checkbox **/
add_action( 'wp_footer', function() { ?>
<script>
(function($) {
$(document).on('click', '.facetwp-depth .facetwp-checkbox', function() {
if ( $( this ).hasClass( "checked" ) ) {
$(this).parent().prev().removeClass('checked');
FWP.autoload();
@pije76
pije76 / gist:6cb0a03d705b56f145cd0014da480f73
Created July 17, 2019 07:54
Checkbox & Number Fields
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="x-dns-prefetch-control" content="on">
<link rel="dns-prefetch" href="https://c.mql5.com">
<meta name="format-detection" content="telephone=no">
<link rel="shortcut icon" href="https://c.mql5.com/i/favicon.ico">
<meta name="msapplication-config" content="none"/>
<?php
/* Template Name: games dynamic */
global $avia_config;
/*
* get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory.
*/
get_header();
if( get_post_meta(get_the_ID(), 'header', true) != 'no') echo avia_title();
?>
<div class='container_wrap container_wrap_first main_color shop_columns_3 <?php avia_layout_class( 'main' ); ?>'>
@pije76
pije76 / custom-hooks.php
Created July 15, 2019 04:48 — forked from djrmom/custom-hooks.php
facetwp fade out/in with pre-load
<?php
/**
** update of https://facetwp.com/fade-template-content-during-refresh/ to only fade in on pre-load
**/
add_action( 'wp_footer', function() { ?>
<style>
.facetwp-template {
opacity: 0;
}
<script>
(function($) {
$(document).on('facetwp-refresh', function() {
location.reload()
});
})(jQuery);
</script>
@pije76
pije76 / test.js
Created July 15, 2019 04:47 — forked from mgibbs189/test.js
Code used for facetWP reload page loop
<script>
(function($) {
$(document).on('facetwp-refresh', function() {
if (FWP.loaded) { // after the initial pageload
FWP.parse_facets(); // load the values
FWP.set_hash(); // set the new URL
location.reload();
return false;
}
});
<?php
/* Template Name: games dynamic */
global $avia_config;
/*
* get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory.
*/
get_header();
if( get_post_meta(get_the_ID(), 'header', true) != 'no') echo avia_title();
$loading_gif_url = home_url().'/wp-content/uploads/2016/08/loading.gif';
@pije76
pije76 / archive-product.php
Created July 14, 2019 23:02 — forked from lukecav/archive-product.php
OceanWP - WooCommerce archive product template for FacetWP
<?php
/**
* The Template for displaying product archives, including the main shop page which is a post type archive
*
* This template can be overridden by copying it to yourtheme/woocommerce/archive-product.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you (the theme developer).
* will need to copy the new files to your theme to maintain compatibility. We try to do this.
* as little as possible, but it does happen. When this occurs the version of the template file will.
* be bumped and the readme will list any important changes.