Skip to content

Instantly share code, notes, and snippets.

View mmarj's full-sized avatar
🏠
Working from home

MM Aurangajeb mmarj

🏠
Working from home
View GitHub Profile
@HeyMehedi
HeyMehedi / settings.json
Created November 21, 2022 01:22
Basic WordPress Settings for VSCode
{
"code-runner.saveFileBeforeRun": true,
"workbench.colorTheme": "One Dark Pro",
"editor.fontSize": 16,
"phpfmt.psr2": false,
"phpfmt.passes": [
"PSR2KeywordsLowerCase",
"PSR2LnAfterNamespace",
"PSR2ModifierVisibilityStaticOrder",
"ReindentSwitchBlocks",
@alexander-young
alexander-young / functions.php
Created January 17, 2022 17:00
WP Basic Cleanup
<?php
// //remove emoji support
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');
// // Remove rss feed links
remove_action( 'wp_head', 'feed_links_extra', 3 );
remove_action( 'wp_head', 'feed_links', 2 );
@obiPlabon
obiPlabon / add-ajax-extended.php
Last active May 12, 2021 12:53
Register ajax action hook.
<?php
/**
* Register ajax action hook.
*
* When you have lots of ajax actions in your theme or plugin then
* this utility function is going to be quite handy!
* By default all actions are for logged in users.
*
* Usage:
* add_ajax( 'get_infinity_posts', 'prefix_get_infinity_posts' ); // for logged in only
@sergiu-radu
sergiu-radu / gist:e5404948d6b018d9ec3766c5fb680611
Created March 25, 2021 09:40
Search shortcode (with live results)
// 1. Add this code in your functions.php file
add_shortcode('wpbsearch', 'get_search_form');
// 2. Call the shortcode wherever you want like this:
[wpbsearch]
@alamgircsebd
alamgircsebd / dokan_thank_you_order_received_text_modified
Last active December 9, 2021 23:10
Thank you message modified to vendor info on order received page
// How Use => Add this scripts on your theme functions.php file
// Output => https://prnt.sc/y4ljek
/**
* Thank you message modified to vendor info on order received page
*
* @param string $thank_you_title
* @param obj $order
@alexander-young
alexander-young / functions.php
Created January 15, 2020 02:32
Defer Javascript in WordPress
function defer_parsing_of_js($url)
{
if (is_admin()) return $url; //don't break WP Admin
if (false === strpos($url, '.js')) return $url;
if (strpos($url, 'jquery.js')) return $url;
return str_replace(' src', ' defer src', $url);
}
add_filter('script_loader_tag', 'defer_parsing_of_js', 10);
@alexander-young
alexander-young / steps.md
Created November 6, 2019 03:42
Install Redis for WordPress

Installing Redis

  • sudo apt update
  • sudo apt install redis-server
  • sudo nano /etc/redis/redis.conf
  • supervised systemd
  • maxmemory 128M
  • maxmemory-policy allkeys-lfu
  • sudo systemctl restart redis.service
  • sudo systemctl status redis
  • redis-cli and ping
@iqbalrony
iqbalrony / custom-css.php
Last active November 22, 2023 11:56
How to add custom css control with elementor free version.
<?php
use Elementor\Controls_Manager;
use Elementor\Element_Base;
use Elementor\Core\Files\CSS\Post;
use Elementor\Core\DynamicTags\Dynamic_CSS;
// Exit if accessed directly
if (!defined('ABSPATH')) {
exit;
@andrewlimaza
andrewlimaza / my-wp-zapier-send-meta.php
Created April 3, 2019 12:34
Send WordPress user meta data to Zapier.
<?php
/**
* This requires version 1.3+ for WP Zapier Plugin - https://yoohooplugins.com/plugins/zapier-integration/
* You may follow this function as a guide to send user meta to Zapier, or any other data really.
* This code runs whenever a user's profile is updated.
* Add the below code to a custom plugin/Child Theme function.php
*/
function my_wp_zapier_send_meta( $array, $user, $user_id ) {
@mahbubme
mahbubme / solution.php
Created December 28, 2018 05:12
Function to return WPUF edit post URL
<?php
function wpuf_post_edit_link() {
global $post;
$edit_page = (int) wpuf_get_option( 'edit_page_id', 'wpuf_frontend_posting' );
$post_id = $post->ID;
$url = add_query_arg( array('pid' => $post->ID), get_permalink( $edit_page ) );
return wp_nonce_url( $url, 'wpuf_edit' );
}