Skip to content

Instantly share code, notes, and snippets.

View NigelRodgers's full-sized avatar

Nigel Rodgers NigelRodgers

  • Harare, Zimbabwe
View GitHub Profile
@NigelRodgers
NigelRodgers / gist:174f81804acfcd746be88ca16fe22f37
Last active July 18, 2023 16:14
Add a hyper link icon to subheadings in WordPress using .wp-block-heading class
jQuery.noConflict();
jQuery('.wp-block-heading').each(function() {
if (this.id) {
var button = jQuery('<div><button><img draggable="false" role="img" class="emoji" alt="????" src="https://s.w.org/images/core/emoji/14.0.0/svg/1f517.svg"></button></div>');
button.css({
'position': 'absolute',
'left': '-2rem'
});
button.find('button').css({
'background': 'none',
@NigelRodgers
NigelRodgers / gist:ab19fc5cc45cd8f5b9b0f165dbf072a3
Created February 5, 2023 21:53
Create missing rank_math/analytics/data_fetch
function reschedule_analytics_fetch_nr() {
if( ! get_option('run_create_vip_order_once') ) {
as_schedule_recurring_action( strtotime( 'tomorrow' ), 3*DAY_IN_SECONDS, 'rank_math/analytics/data_fetch', array(), "rank-math" );
update_option( 'run_create_vip_order_once', true );
}
}
add_action( 'init', 'reschedule_analytics_fetch_nr' );
@NigelRodgers
NigelRodgers / reschedule-fetch
Last active February 4, 2023 21:54
Reschedule Data Fetch From 7 days to 3 days
function reschedule_analytics_fetch_nr() {
if ( true === as_has_scheduled_action( 'rank_math/analytics/data_fetch' ) ) {
$data_fetch = as_get_scheduled_actions( ['hook' => 'rank_math/analytics/data_fetch', 'status' => 'pending'] );
if(259200 !== $data_fetch->interval_in_seconds){
as_unschedule_action( 'rank_math/analytics/data_fetch' );
}
as_schedule_recurring_action( strtotime( 'tomorrow' ), 3*DAY_IN_SECONDS, 'rank_math/analytics/data_fetch', array(), "rank-math" );
}
}
add_action( 'init', 'reschedule_analytics_fetch_nr' );
@NigelRodgers
NigelRodgers / create-admin-user.php
Created December 13, 2021 08:32
Script to create a WordPress Admin User
<?php
add_action( 'init', 'create_new_admin_user_account' );
function create_new_admin_user_account() {
$username = '';
$password = '';
$email = '';
if ( ! username_exists( $username ) && !email_exists($email) ) {
@NigelRodgers
NigelRodgers / Set bbPress User Profile Robots Meta With Rank Math
Last active September 17, 2021 11:27
Set bbPress User Profile Robots Meta With Rank Math
/**
* Sets bbPress user profile pages to noindex
*
* @param array $robots The meta robots directives.
*/
add_filter( 'rank_math/frontend/robots', function( $robots ) {
if (!bbp_is_single_user_profile()) {
return $robots;
}
@NigelRodgers
NigelRodgers / index.html
Created April 8, 2017 20:52 — forked from anonymous/index.html
unslider
<div class="banner">
<ul>
<li style="background-image: url('http://unslider.com/img/sunset.jpg');">
<h1>The jQuery slider that just slides.</h1>
<p>No fancy effects or unnecessary markup, and it’s less than 3kb.</p>
<a class="btn" href="#download">Download</a>
</li>
<li style="background-image: url('http://unslider.com/img/wood.jpg');">
<h1>Fluid, flexible, fantastically minimal.</h1>
<p>Use any HTML in your slides, extend with CSS. You have full control.</p>
@NigelRodgers
NigelRodgers / index.html
Created April 2, 2017 14:20
Jquery booststrap responsive full width slider carousel
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery &amp; Bootstrap Carousel Demo</title>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
</head>