Skip to content

Instantly share code, notes, and snippets.

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

Emmanuel Joseph jekayode

🏠
Working from home
  • Ladders Technologies Limited
  • Nigeria
View GitHub Profile
@jekayode
jekayode / wp-rocket-cache-control-scheduler.php
Created July 2, 2024 06:18
A PHP script to be included in the functions.php file of a WordPress theme. This script schedules daily events to disable WP Rocket caching at 10:58 AM and re-enable it at 11:30 AM, including a cache cleanup. It ensures cache control actions are performed automatically at specified times, accommodating frequent updates via the Custom API.
<?php
// Schedule the 'rocket_is_importing' filter to be added at 10:58 AM daily
add_action('init', 'schedule_cache_control');
function schedule_cache_control() {
if (!wp_next_scheduled('add_importing_filter_event')) {
wp_schedule_event(strtotime('10:58:00'), 'daily', 'add_importing_filter_event');
}
}
@jekayode
jekayode / set_maximum_coupon_percentage_discount.php
Created November 30, 2021 21:40
WooCommerce set maximum coupon discount
add_action( 'woocommerce_coupon_options_usage_limit', 'woocommerce_coupon_options_usage_limit', 10, 2 );
function woocommerce_coupon_options_usage_limit( $coupon_id, $coupon ){
echo '
';
// max discount per coupons
$max_discount = get_post_meta( $coupon_id, '_max_discount', true );
woocommerce_wp_text_input( array(
'id' => 'max_discount',
'label' => __( 'Usage max discount', 'woocommerce' ),
'placeholder' => esc_attr__( 'Unlimited discount', 'woocommerce' ),
@jekayode
jekayode / gtm-woocommerce.php
Last active November 12, 2020 09:41
Implement Google Tag on Woocommerce thank you page
function push_to_datalayer($order_id) {
$order = wc_get_order( $order_id );
?>
<script type='text/javascript'>
window.dataLayer = window.dataLayer || [];
dataLayer.push({
'event' : 'transaction',
'ecommerce' : {
APP_NAME=Nile
APP_ENV=production
APP_KEY=appkeygenerate=
APP_DEBUG=false
APP_URL=https://app.nileuniversity.edu.ng
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
<?php
require 'vendor/autoload.php';
use Mailgun\Mailgun;
// First, instantiate the SDK with your API credentials
$mg = Mailgun::create('my-domain-apikey'); // For US servers
//$mg = Mailgun::create(‘my-apikey, 'https://api.eu.mailgun.net'); // For EU servers
$name = "Emmanuel";
$email = "emmanuel@email.com";
@jekayode
jekayode / gist:d933512f0abad596d39f843490e38bac
Created May 18, 2020 05:12
WordPress menu items without a custom Walker
<?php $menu_location = 'some_menu_location'; ?>
<?php if ( has_nav_menu( $menu_location ) ): ?>
<?php $menu_items = wp_get_nav_menu_items( wp_get_nav_menu_name( $menu_location ) ); ?>
<?php foreach ( $menu_items as $menu_item ): ?>
<a href="<?= esc_url( $menu_item->url ) ?>"
target="<?= esc_attr( $menu_item->target ?: '_self' ) ?>"
class="<?= esc_attr( implode( ' ', $menu_item->classes ) ) ?>"><?= esc_html( $menu_item->title ) ?></a>
@jekayode
jekayode / .htaccess
Created November 8, 2019 10:50 — forked from seoagentur-hamburg/.htaccess
UPDATE 2019/07: Perfect .htaccess file for highspeed and security. You can use it for every WordPress-Website without problems. Highspeed and Security - testet on hundreds of Websites. If you are using a WordPress Multisite, change the last part of this file.
########################################################################
# OPTIMAL .htaccess FILE FOR SPEED AND SECURITY @Version 2019
# ----------------------------------------------------------------------
# @Author: Andreas Hecht
# @Author URI: https://andreas-hecht.com
# License: GNU General Public License v2 or later
# License URI: http://www.gnu.org/licenses/gpl-2.0.html
########################################################################
@jekayode
jekayode / deployment_guide.md
Created August 7, 2019 02:49 — forked from vicgonvt/deployment_guide.md
Deployment Guide for Ubuntu Server from Scratch with Laravel
@jekayode
jekayode / tabbed_taxonomy.php
Created November 16, 2018 12:47 — forked from FernE97/tabbed_taxonomy.php
PHP: WordPress custom taxonomy/post query
<?php
$args = array(
'orderby' => 'ID'
);
$terms = get_terms( 'testimonial_category', $args );
?>
<!-- bootstrap tabs -->
<ul class="nav-tabs">
<?php
@jekayode
jekayode / install.md
Created November 3, 2018 10:44 — forked from yugaego/install.md
Mac OS 10.13 High Sierra Install PHP 7.0 Apache MariaDB With Homebrew