Skip to content

Instantly share code, notes, and snippets.

View morosmo's full-sized avatar
🎯
Focusing

D-E-V morosmo

🎯
Focusing
  • Morosoft
  • Rawalpindi
  • 22:59 (UTC +05:00)
View GitHub Profile
<?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') {
@giovanni-d
giovanni-d / allinonemigration.md
Last active August 14, 2025 10:32
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: May 2025 on version 7.94

var filename = 'FILENAME.wpress';
@Crocoblock
Crocoblock / get-related.md
Last active April 25, 2025 05:46
Get JetEngine Related Items programmatically / Update related items / Get/Update relation meta
@Crocoblock
Crocoblock / jsf-exclude-options.php
Last active May 27, 2025 10:21
JetSmartFilters Exclude filter options programmatically
<?php
add_filter( 'jet-smart-filters/filters/filter-options', function( $options, $filter_id ) {
if ( $filter_id != 265823 ) {
return $options;
}
$exclude = array(
24 => true,
@ihslimn
ihslimn / jsf-extend-search.php
Last active May 27, 2025 10:20
JetSmartFilters Extend Search
<?php
class JSF_Extend_Search {
public function __construct() {
add_filter( 'jet-smart-filters/query/request', array( $this, 'modify_request' ), 0, 2 );
}
public function modify_request( $request, $manager ) {
@ihslimn
ihslimn / jsf-dv-meta.php
Created June 26, 2023 08:36
JetSmartFilters Meta Dynamic Visibility
<?php
add_filter( 'jet-smart-filters/query/meta-query-row', function( $row ) {
if ( in_array( $row['key'], array( '__reload_provider' ) ) ) {
$row = array();
}
return $row;
@Crocoblock
Crocoblock / jfb-call-hook.php
Last active August 21, 2025 05:12
JetFormBuilder Call Hook action
<?php
add_action( 'jet-form-builder/custom-action/test-hook', function( $request, $action_handler ) {
//get value of field field1
$value = $request['field1'];
//or using jet_fb_context()->resolve_request()
$value = jet_fb_context()->resolve_request()['field1'];
@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 / 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.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 ) {