Skip to content

Instantly share code, notes, and snippets.

View morosmo's full-sized avatar
🎯
Focusing

D-E-V morosmo

🎯
Focusing
  • Morosoft
  • Rawalpindi
  • 15:02 (UTC +05:00)
View GitHub Profile
/// PROBLEM ///
// Listing grid of a CPT.
// Each row has an EDIT button.
// The button opens a JetPopup with a form inside.
// After editing the fields, I cannot configure a REDIRECT action in the form, as it refreshes the page and the listing returns to the first page.
// If the edit occurred on page 10, it's a hassle to have to return to the page where you were before EDITING every time.
// 👉 Place inside an HTML widget on the page where the popup will open.
jQuery(document).ready(function ($) {
$(window).on("jet-popup/render-content/ajax/success", function (event, params) {
$(document).on("jet-form-builder/ajax/on-success", function () {
@Lonsdale201
Lonsdale201 / code
Last active March 20, 2025 02:30
JetFormBuilder - Formless Action success reload jetengine lisitng grid with ajax
(function($) {
'use strict';
/**
* Developer note:
* This code use the native "fetch" function to intercept AJAX calls
* for the 'remoovehouuse' endpoint. When it detects a successful (HTTP 200)
* response with `{"code":"success"}`, it automatically reloads all Listing Grids
* that have the class ".formless-ajax.elementor-widget-jet-listing-grid".
* Change the .formless-ajax if you want to use different class target
@VictorPietro
VictorPietro / close_jetpopup_after_jetformbuilder_successful_submit.js
Created January 15, 2025 06:27
Close a JetPopup after successful JetFormBuilder submit
jQuery(document).ready(function($) {
// Listen for the JetFormBuilder submit success event
$(document).on('jet-form-builder/ajax/on-success', function() {
// Wait for 2 seconds after the form is successfully submitted
setTimeout(function() {
// Simulate a click on the popup close button
$('.jet-popup__close-button').trigger('click');
}, 2000); // Time in milliseconds (2 seconds)
});
});
@Crocoblock
Crocoblock / jet-engine-macros-shortcode.php
Last active March 2, 2025 16:12
Register [jet_engine_macros] shortcode to use JetEngine macros anywhere
<?php
/**
* How to use:
* 1. Add this code to your website with any code snippets plugin or into functions.php of your active theme.
* 2. In your admin area go to JetEngine/Macros Generator, generate and copy macros you need.
* 3. Use this macros anywhere with shortcode in following format: [jet_engine_macros macros="%generated_macros%"]
*
* Real world example:
* [jet_engine_macros macros="%jet_engine_field_name|event_date|field_value%"]
*/
@Crocoblock
Crocoblock / code.html
Last active April 16, 2025 09:23
JetFormBuilder Do something on form submit
<script>
document.addEventListener( 'DOMContentLoaded', function() {
const {
addAction,
} = window.JetPlugins.hooks;
addAction( 'jet.fb.observe.after', 'example/onSubmit', init );
function init( observable ) {
@Crocoblock
Crocoblock / code.php
Created December 20, 2023 13:34
JetAppointment Exclude not full-duration slots
<?php
add_filter( 'jet-apb/time-slots/slots-html/slots-list', function( $slots, $format, $dataset, $date, $service, $provider ) {
$duration = jet_apb()->calendar->get_schedule_settings( $provider, $service, null, 'default_slot' );
foreach ( $slots as $time => $slot ) {
if ( $slot['to'] - $slot['from'] < $duration ) {
unset( $slots[ $time ] );
}
@Crocoblock
Crocoblock / code.js
Last active February 20, 2025 18:58
JetFormBuilder JS
//jQuery submit success
jQuery( document ).on( 'jet-form-builder/ajax/on-success', function( event, response, $form ) {
//do something
} );
//wp hook on submit
//https://gist.github.com/Crocoblock/d6d1828a785ad55addb8f497deb7f3ba
//to get Observable that represents the form with ID of 128
let observable = JetFormBuilder[128];
@Crocoblock
Crocoblock / get-related.md
Last active April 25, 2025 05:46
Get JetEngine Related Items programmatically / Update related items / Get/Update relation meta
@giovanni-d
giovanni-d / allinonemigration.md
Last active April 30, 2025 15:17
All-in-One WP Migration - Restore From Server (without PRO version) - Restore

All-in-One WP Migration Restore From Server (without pro version)

If you don't want to pay for the PRO version of this plugin, and you want to use the "Restore from Server" functionally that was present in the version 6.77, open your browser’s dev tools and run the code below in the console:

Last confirmed working: March 2025 on version 7.91

Thanks @xxxdepy, and @tanveeratlogicx for confirming this still works in version 7.91!

<?php
/*
Plugin Name: Instrument Hooks for WordPress
Description: Instruments Hooks for a Page. Outputs during the Shutdown Hook.
Version: 0.1
Author: Mike Schinkel
Author URI: http://mikeschinkel.com
*/
if (isset($_GET['instrument']) && $_GET['instrument']=='hooks') {