Skip to content

Instantly share code, notes, and snippets.

@ihslimn
ihslimn / code.html
Created June 27, 2024 17:28
JetFormBuilder Set total amount for multiple number field
<script>
document.addEventListener( 'DOMContentLoaded', function() {
const {
addAction,
} = window.JetPlugins.hooks;
addAction( 'jet.fb.observe.after', 'total-amount', init );
function init( observable ) {
@ihslimn
ihslimn / code.php
Created May 16, 2024 13:34
Jet_Appointment_Add_Current_Link
<?php
class Jet_Appointment_Add_Current_Link {
private $query_var = 'jet_apb_add_current_to_calendar';
public function __construct() {
add_action( 'plugins_loaded', array( $this, 'add_filters' ), 1000 );
}
@ihslimn
ihslimn / code.php
Created April 30, 2024 19:10
JetEngine Query correct per page for Sticky Posts (not guaranteed to work with pagination)
<?php
add_filter( 'jet-engine/query-builder/query/items', function( $items, $query ) {
if ( false !== strpos( $query->name, '--sticky-correct' ) ) {
$per_page = ! empty( $query->final_query['posts_per_page'] ) ? $query->final_query['posts_per_page'] : 10;
$items = array_slice( $items, 0, $per_page );
}
return $items;
}, 0, 2 );
@ihslimn
ihslimn / code.php
Created April 24, 2024 17:43
JetReviews Remove emails from structured data
<?php
class Jet_Reviews_Rich_Snippets_Email_Remover {
private $remove_email = false;
public function __construct() {
add_action( 'elementor/frontend/widget/before_render', array( $this, 'set_remove_flag' ) );
add_filter( 'jet-reviews/user-manager/raw-user-data', array( $this, 'remove_email' ) );
}
@ihslimn
ihslimn / code.php
Created April 24, 2024 09:29
JetTabs Combined FAQ
<?php
class Jet_Tabs_Combined_Faq {
private $schema = array();
private $widget = null;
private $store = false;
public function __construct() {
add_filter( 'jet-tabs/widget/loop-items', array( $this, 'store_widget' ), 100, 3 );
@ihslimn
ihslimn / code.php
Created April 16, 2024 10:57
JetSmartFilters Get range filter min/max from CCT
<?php
add_filter( 'jet-smart-filters/range/source-callbacks', function( $callbacks ) {
$callbacks['jet_smart_filters_cct_values'] = 'Get from CCT field';
return $callbacks;
} );
add_filter( 'jet-smart-filters/filter-instance/args', function( $args ) {
@ihslimn
ihslimn / code.php
Created February 28, 2024 08:27
JetWooBuilder Show product atributes in cart
<?php
add_filter( 'get_post_metadata', function( $value, $post_id, $key ) {
if ( $key !== 'cart_product_atributes' ) {
return $value;
}
if ( ! get_post( $post_id ) ) {
return $value;
@ihslimn
ihslimn / code.html
Last active August 29, 2024 11:29
JetFormBuilder Hierarchical Select set not required levels if empty
<style>
.jet-form-builder-hr-select-level.not-required .jet-form-builder__required {
display: none;
}
</style>
<script>
jQuery( document ).ready( function( $ ) {
$( window ).on( 'jet-form-builder/after-init', initWatchers );
@ihslimn
ihslimn / code.php
Created January 3, 2024 18:59
JetSmartFilters Set default value
<?php
class JSFC_Default_Value_Shortcode {
private $defaults = array();
private $script_enqueued = false;
public function __construct() {
add_shortcode( 'jsf_default_value', array( $this, 'do_shortcode' ) );
@ihslimn
ihslimn / code.php
Last active December 29, 2023 13:47
JetSmartFilters Search for the exact value in the list
<?php
class JSF_Search_In_List {
private $prefix = 'in_list';
private $delimiter = '__';
public function __construct() {
add_filter( 'jet-smart-filters/query/final-query', array( $this, 'modify_query' ) );
add_action( 'jet-smart-filters/admin/register-dynamic-query', array( $this, 'helper_dynamic_query' ) );