Skip to content

Instantly share code, notes, and snippets.

View moxet's full-sized avatar

Abdul Muqsit moxet

View GitHub Profile
@moxet
moxet / gist:32e34740bec6c87e8ce35ac70202e660
Last active August 17, 2023 06:28
Return Flat Terms with Levels from Shortcode [jet_post_terms tax="your-taxonomy" lvl="2"]
add_shortcode( 'jet_post_terms', function( $atts = array() ) {
$atts = shortcode_atts( array(
'tax' => '',
'lvl' => ''
), $atts, 'jet_post_terms' );
$post_id = get_the_ID();
if ( empty( $atts['tax'] ) ) {
return;
@moxet
moxet / notify.php
Last active October 25, 2025 02:38
Send Notification via JetForm Builder / JetEngine
add_action( 'jet-form-builder/custom-action/send_notification', function( $request, $action_handler ) {
$cct_id = $request['inserted_cct_notifications'];
$email_notify = $request['email_notify'];
$notification_details = $request['notification_details'];
$users = get_users();
foreach ($users as $user) {
$user_id = $user->ID;
@moxet
moxet / read_receipt.js
Created August 25, 2023 12:59
Jquery Code to Read Notification
<script>
jQuery(document).ready(function($) {
$(document).on('click',".fa-check-circle",function () {
var cct_id = $(this).siblings('.jet-listing-dynamic-field__content').text();
jQuery.ajax({
type: "post",
dataType: "json",
@moxet
moxet / email.html
Last active April 11, 2025 14:47
Transactional Email Template for JetFormBuilder, copy the code below and paste it in Jet Form Builder Email action content section, make sure to enable html as content type instead of text.
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body style="background-color: #2a2a2a;
font-family: arial;
-webkit-font-smoothing: antialiased;
font-size: 16px;
@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();
@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 / 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 / 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> ');
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 / 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