Skip to content

Instantly share code, notes, and snippets.

@jennlee20
jennlee20 / wordpress-exclude-product-categories-in-search.php
Created Oct 3, 2020
[Wordpress] Exclude product category by slug in seach result.
View wordpress-exclude-product-categories-in-search.php
<?php
function jenn_search_filter_pre_get_posts( $query ) {
if ($query->is_search()) {
$query->set( 'post_type', array( 'product' ) );
$tax_query = array(
array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => 'your-product-category-slug-1',
View wordpress-hide-admin-menu-bar.php
<?php
/**Remove Admin Bar Button**/
add_action( 'admin_bar_menu', 'me_remove_admin_bar', 999 );
function me_remove_admin_bar( $wp_admin_bar ) {
if( is_user_logged_in() ) {
$user = wp_get_current_user();
$roles = ( array ) $user->roles;
if (in_array('editor',$roles)) {
//to check what nodes
View wordpress-jetengine-update-repeater-field.php
<?php
/**
* Only for jet-engine repeater field
* In this example, i want to update repeater meta_field name = company-services
* 3 columns in repeater field _service-image, _service-name, _service-description
*/
//Example value from my fluent form
$value_from_form = array(
array("Service 1","Description 1"),
@jennlee20
jennlee20 / wordpress-fluentform-javascript-triggers.js
Last active Oct 18, 2020
wordpress-fluentform-javascript-triggers.js
View wordpress-fluentform-javascript-triggers.js
$form.on('ff_to_next_page', function(activeStep, form) {
console.log(activeStep);
// You can run your own JS on step change
});
$form.on('ff_to_prev_page', function(activeStep, form) {
console.log(activeStep);
// You can run your own JS on step change
});
View wordpress-fluentform-steps-select2-bug.css
/*If dropdown field using select2 js and the form height is small, causing the options hidden*/
.fluent_form_1 .choices__list--dropdown.is-active {
z-index: 3 !important;
}
.fluent_form_1 .fluentform-step.active {
overflow: visible !important;
min-height: 80vh !important;
}
@jennlee20
jennlee20 / wordpress-fluentform-stepform-final-step-button-bug.css
Last active Oct 9, 2020
fluentform-stepform-final-step-button-bug.css
View wordpress-fluentform-stepform-final-step-button-bug.css
/*In final step, the button left and right showing as different line in mobile mode.*/
.fluent_form_1 .ff-t-container.ff-inner_submit_container.ff-column-container {
display: flex !important;
justify-content: space-between !important;
}
View wordpress-elementor-remove-nav-outline.css
.elementor-menu-toggle:focus {
outline: none;
/*outline-color : #aaa;*/
box-shadow: none;
}
View wordpress-fluentform-official-js-snippets.js
/*
* JS snippet to match two fields value as same
* Example: Email and Confirm Email need to be same
* Placement: Place the following code in your form -> Settings & Integrations -> Custom CSS/JS -> Custom Javascript BOX
*/
var $email = $form.find('input[name=email]'); // Name of the first Email Address
var $confirmEmail = $form.find('input[name=confirm_email]'); // Name of the Confirm Email Address
$confirmEmail.on('blur', function() {
View wordpress-fluentform-javascript-display-repeater-values.js
var myHtml = '';
$('input[data-name^="ff_repeater_field_name"]').each(function(){
let value = $(this).val();
let position = $(this).attr('data-name').substr( $(this).attr('data-name').length -3, 1);
if (value !== '') {
/*My repeater field only consists of 2 columns, so position 0 = 1st column, 2 = 2nd column*/
if (position == '0') {
myHtml = myHtml + `${escapeHtml(value)}:<br>`;
} else {
View wordpress-make-all-background-blur.css
#page {
width: 100%;
height: 100%;
background: inherit;
position: absolute;
left: -25px;
right: 0;
top: -25px;
bottom: 0;
/*box-shadow: inset 0 0 0 200px rgba(255,255,255,0.3);*/