Skip to content

Instantly share code, notes, and snippets.

View abbeymaniak's full-sized avatar
🧘‍♂️
Chilling...

Abiodun Paul Ogunnaike abbeymaniak

🧘‍♂️
Chilling...
View GitHub Profile
@abbeymaniak
abbeymaniak / functions.php
Created August 16, 2025 08:52 — forked from jordanmaslyn/functions.php
Fix Yoast sitemaps when working with headless WP
<?php
/*
* Replacing domain for rest api requests from Gutenberg editor if youre using
* WP headless and WP_SITEURL & WP_HOME are not the same domain
* (has nothing to do with yoast)
*/
add_filter('rest_url', function($url) {
$url = str_replace(home_url(), site_url(), $url);
return $url;
@abbeymaniak
abbeymaniak / functions.php
Created February 18, 2025 19:23 — forked from LearnWebCode/functions.php
WordPress functions to fetch external JSON (and store in transient + option backup) and also functions to setup programmatic URL patterns and use custom template files for said URLs
function get_cached_external_json($url) {
$transient_key = 'our_fetched_json_' . md5($url);
$option_key = 'our_fetched_json_backup_' . md5($url);
$cached_data = get_transient($transient_key);
if (false !== $cached_data) {
return $cached_data;
}
@abbeymaniak
abbeymaniak / functions.php
Created February 18, 2025 19:23 — forked from LearnWebCode/functions.php
WordPress functions to fetch external JSON (and store in transient + option backup) and also functions to setup programmatic URL patterns and use custom template files for said URLs
function get_cached_external_json($url) {
$transient_key = 'our_fetched_json_' . md5($url);
$option_key = 'our_fetched_json_backup_' . md5($url);
$cached_data = get_transient($transient_key);
if (false !== $cached_data) {
return $cached_data;
}
@abbeymaniak
abbeymaniak / git-cheat-sheet.md
Created January 29, 2025 08:43 — forked from bradtraversy/git-cheat-sheet.md
Cheat Sheet for Git Crash Course

Git & GitHub Crash Course 2025 Cheat Sheet

What is Git?

Git is a distributed version control system that allows developers to:

  • Track changes in code.
  • Collaborate on projects.
  • Manage multiple versions of a project.
  • Work offline with a full local repository.
# WP Config Settings
wp config set AUTOMATIC_UPDATER_DISABLED true
wp config set CORE_UPGRADE_SKIP_NEW_BUNDLED true
# Changing Site URL to https
wp option get siteurl | sed "s/http:/https:/g" | xargs -I {} wp option update siteurl {}
wp option get home | sed "s/http:/https:/g" | xargs -I {} wp option update home {}
# Install themes & plugins
@abbeymaniak
abbeymaniak / .eslintrc.cjs
Created May 4, 2024 01:06 — forked from adrianhajdin/.eslintrc.cjs
Tailwind CSS Full Course 2023 | Build and Deploy a Nike Website
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],

Install phpcs with Homebrew

To set up php linting, you’ll want to install this PHP CodeSniffer repo and configure with this WordPress Coding Standards repo: . There are a number of ways to do this, whether direct download, Composer, Homebrew, Pear, etc. The following is what works for me on MacOS using Homebrew:

In a terminal window on your Mac, start by updating your Homebrew.

brew doctor

Then install the Code Sniffer:

<?php
/*
Copyright 2007-2009 John Havlik (email : [email protected])
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@abbeymaniak
abbeymaniak / breadcrumb.component.ts
Created May 21, 2023 10:25
Example Angular Breadcrumbs with naviation and restore
import { Component, OnInit, OnDestroy, Pipe, PipeTransform } from '@angular/core';
import { ActivatedRoute, Router, NavigationExtras, NavigationStart, NavigationEnd } from '@angular/router';
import { startWith, filter, pairwise, map, subscribeOn } from 'rxjs/operators';
import { Subscription } from 'rxjs';
import { MessageSubjectService } from '../services/message-subject.service';
import * as glob from '../services/globals';
@Component({
moduleId: module.id.toString(),
selector: 'breadcrumb',
@abbeymaniak
abbeymaniak / custom-queries.php
Created May 14, 2023 08:59 — forked from carlodaniele/custom-queries.php
An example plugin showing how to add custom query vars, rewrite tags and rewrite rules to WordPress
<?php
/**
* @package Custom_queries
* @version 1.0
*/
/*
Plugin Name: Custom queries
Plugin URI: http://wordpress.org/extend/plugins/#
Description: This is an example plugin
Author: Carlo Daniele