Skip to content

Instantly share code, notes, and snippets.

View moxet's full-sized avatar

Abdul Muqsit moxet

View GitHub Profile
@moxet
moxet / gist:0d5b779b993eabec10e14a91c9a33085
Created July 18, 2025 08:36
Save Image from REST API to Wordpress
add_action('jet-form-builder/custom-action/saveimage', function( $request, $action_handler ) {
$image_url = $request['image_file'];
$post_id = $request['inserted_post_id'];
// Get image data from URL
$image_data = file_get_contents($image_url);
// Set the path to the WordPress uploads directory
$upload_dir = wp_upload_dir();
@moxet
moxet / gist:529a81feec65b7f694fc8bf70fc4f3ba
Created July 18, 2025 08:07
Import Wordpress CPT - JetEngine FrontEnd
function leads_import_csv_shortcode() {
if (isset($_POST['submit']) && !empty($_FILES['csv_file']['tmp_name'])) {
$csv_file = $_FILES['csv_file']['tmp_name'];
$handle = fopen($csv_file, 'r');
$header = fgetcsv($handle, 1000, ','); // Read and skip the header row
while (($col = fgetcsv($handle, 1000, ',')) !== FALSE) {
$post_title = $col[0];
$phone = $col[1];
$email = $col[2];
@moxet
moxet / code.php
Created July 7, 2025 08:22 — forked from Crocoblock/code.php
JetFormBuilder Do something on receiving webhook response
<?php
add_action( 'jet-form-builder/action/webhook/response', function( $response, $settings ) {
//get webhook url
$url = $settings['webhook_url'];
//check if we are using some specific endpoint
if ( false === strpos( $url, 'random-string/v1/generate' ) ) {
return;
@moxet
moxet / gist:83bdabca265aad94fec4d45933ecd53a
Created December 17, 2024 08:37
Jet Form Builder to Monday.com CRM
//Use below code in your function.php or code snippet, Open your Jet Form Builder form and insert a hook in action, name your hook as monday. make sure the name of the field map in the requested variable below.
add_action('jet-form-builder/custom-action/monday', function( $request, $action_handler ) {
$name = $_REQUEST["full_name"];
$email = $_REQUEST["email"];
$contact_number = $_REQUEST["contact_number"];
$message = $_REQUEST["message"];
$token = 'API_KEY_GOES_HERE';
$apiUrl = 'https://api.monday.com/v2';
@moxet
moxet / get-related.md
Created September 10, 2024 06:08 — forked from Crocoblock/get-related.md
Get JetEngine Related Items programmatically / Update related items / Get/Update relation meta
add_action('jet-form-builder/custom-action/assign_author_cct', function( $request, $action_handler ) {
// Getting code value from JFB
$author_id = $request['customer_id'];
$cct_id = $request['inserted_cct_subscriptions'];
global $wpdb;
$table_name = $wpdb->prefix . 'jet_cct_subscriptions';
@moxet
moxet / gist:c5e270b9de422d193f5a4aff463bb1a5
Last active December 10, 2024 15:48
Jquery Code for REST API Pagination
<div id="pagin"></div>
<script>
jQuery(document).ready(function($) {
var pageSize = 12; // Number of items per page
var pageCount = Math.ceil($("#fertility .jet-listing-grid__item").length / pageSize); // Calculate total pages
for (var i = 1; i <= pageCount; i++) {
$("#pagin").append('<a href="#" class="page-link">' + i + '</a> ');
@moxet
moxet / auto-refresh.js
Created February 23, 2024 17:17
This JQuery allows you to refresh listing without page refresh, make sure to apply .mylisting class to your listing. The timeout function improve the UX by hiding success message after 3 seconds
<script>
jQuery(document).ready(function($) {
$('.jet-form-builder__submit').on('click', function() {
$('.mylistings').load(window.location.href + ' .mylistings');
setTimeout(function() {
$(".jet-form-builder-messages-wrap").fadeOut();
}, 3000);
});
});
@moxet
moxet / logout.php
Created January 25, 2024 08:28
Wordpress Logout without Confirmation
add_action('check_admin_referer', 'logout_without_confirm', 10, 2);
function logout_without_confirm($action, $result)
{
/**
* Allow logout without confirmation
*/
if ($action == "log-out" && !isset($_GET['_wpnonce'])) {
$redirect_to = isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : 'https://yoursite.com';
$location = str_replace('&amp;', '&', wp_logout_url($redirect_to));
header("Location: $location");
@moxet
moxet / google-wp-rest-api
Created December 19, 2023 12:45
Google Apps Script for Inserting Google Sheet Data to Wordpress as CPT
function Sheet_WP(e) {
var sheet = e.source.getActiveSheet();
//replace CPT with your sheet name
if(sheet.getName() == 'CPT'){
var range = e.range;
var affectedRow = range.getRow();
var postId = sheet.getRange(affectedRow, 1).getValue();