Skip to content

Instantly share code, notes, and snippets.

//
// 1. Change the field name in line 20 instead of 'thumbnail_id'.
// 2. Change the taxonomy slug in line 30 instead of 'product_tag'.
//
// Display thumbnail in admin column as the second column
function display_custom_tag_thumbnail( $columns ) {
// Insert 'tag-thumbnail' as the second column
$columns_before = array_slice( $columns, 0, 1 ); // Extract the first column
$columns_after = array_slice( $columns, 1 ); // Extract the remaining columns
// Combine columns with 'tag-thumbnail' in the middle
@liranop
liranop / AutoApply JetEngine Date Range
Last active January 30, 2024 15:47
AutoApply JetEngine Date Range (+ hide apply button) 0 do not hide the apply button on settings!
<script>
jQuery(document).ready(function($) {
// Select the input fields and apply button
var fromDateInput = jQuery('.jet-date-range__from');
var toDateInput = jQuery('.jet-date-range__to');
var applyButton = jQuery('.jet-date-range__submit');
applyButton.hide();
// Attach event listener for 'input' on the "from" date field
<ul class="tab-steps--list"></ul>
<script>
jQuery(document).ready(function() {
let isDragging = false;
const tabStepsList = jQuery('.tab-steps--list');
function startDrag() {
isDragging = true;
tabStepsList.addClass('dragg');
}
<ul class="tab-steps--list"></ul>
<script>
jQuery(document).ready(function() {
let isDragging = false;
const tabStepsList = jQuery('.tab-steps--list');
function startDrag() {
isDragging = true;
tabStepsList.addClass('dragg');
}
@liranop
liranop / upload media field - hide empty media box
Last active January 29, 2024 04:44
JetFormBuilder & media field - hide empty space above the input when no selected file
<script>
document.addEventListener("DOMContentLoaded", function () {
const fileInputs = document.querySelectorAll(".jet-form-builder-file-upload__input");
function toggleFileContentVisibility(fileContainer) {
const fileContent = fileContainer.querySelector(".jet-form-builder-file-upload__content");
const files = fileContainer.querySelectorAll(".jet-form-builder-file-upload__files .jet-form-builder-file-upload__file");
if (files.length < 1) {
fileContent.style.display = "none";
@liranop
liranop / add select2 to jetsmartfilter select
Last active January 19, 2024 10:04
add select2 to jetsmartfilter select (php code snippet + js script)
<script>
(function() {
jQuery(document).on('jet-smart-filters/inited', function( initEvent ) {
// Initialize select2 on the select field
jQuery('.jet-select__control').select2({
placeholder: 'Search...',
width: '100%',
@liranop
liranop / gist:23b0525475f66ed1fbfedc3a661ce0ab
Last active September 19, 2023 10:46
numeric duration callback to literal (dynamic field widget - elementor + jetengine)
add_filter( 'jet-engine/listings/allowed-callbacks', 'jet_custom_callbacks' );
/**
* Add callback to list.
*/
function jet_custom_callbacks( $callbacks ) {
$callbacks['jet_number_to_duration'] = __( 'Number to duration', 'txt-domain' );
return $callbacks;
//
// https://developers.elementor.com/docs/hooks/custom-query-filter/
//
function custom_get_related_events($query) {
global $post;
// Get the custom field value for the current post
$meta_field = get_post_meta($post->ID, 'meta_field_name', true);
// CHANGE 'meta_field_name' !!!!!! to your relationship filed's name
@liranop
liranop / expend shipping row
Last active August 11, 2023 05:58
Make shipping row in woocommerce cart and checkout to full width
/**
* @snippet Expend WooCommerce Shipping Row in Cart and Checkout
*/
add_action( 'wp_footer', 'expend_shipping_row_jscript', 9999 );
function expend_shipping_row_jscript() {
if ( is_cart() || is_checkout() && empty( $wp->query_vars['order-pay'] ) && ! isset( $wp->query_vars['order-received'] ) ) {
?>
<script type="text/javascript">