Skip to content

Instantly share code, notes, and snippets.

View joshuafredrickson's full-sized avatar
🍊
Orange pineapple

Joshua Fredrickson joshuafredrickson

🍊
Orange pineapple
View GitHub Profile
@joshuafredrickson
joshuafredrickson / rest-api-seo.php
Created December 13, 2022 20:05
The SEO Framework REST API endpoints for WordPress
<?php
/**
* REST API
* The SEO Framework
*
* @package scout_rest_theme
*
* List of title methods
* @link https://github.com/sybrew/the-seo-framework/issues/202#issuecomment-412781194
*
@joshuafredrickson
joshuafredrickson / bud.config.js
Created March 5, 2022 18:38
Bud: Create additional entrypoint for conditional enqueuing
module.exports = async (app) => {
app
/**
* Application entrypoints
*
* Paths are relative to your resources directory
*/
.entry({
app: {
import: ['@scripts/app', '@styles/app'],
@joshuafredrickson
joshuafredrickson / block-editor-cleanup.php
Last active April 19, 2022 13:47
Block Editor Cleanup for WordPress 5.9 and Classic Editor (mu-plugin)
<?php
/**
* Plugin Name: Block Editor Cleanup
* Plugin URI: https://github.com/WordPress/gutenberg/issues/38299#issuecomment-1025520487
* Version: 1.0.1
* Description: Remove WP 5.9 default block editor styles when using Classic Editor
* Author: joshuafredrickson
* Author URI: https://joshuafredrickson.com
* License: GNU General Public License v2
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
@joshuafredrickson
joshuafredrickson / ViewComposer.php
Last active February 3, 2022 17:59
Megamenu in Blade using Alpine JS
<?php
namespace App\View\Composers;
use Roots\Acorn\View\Composer;
use Log1x\Navi\Facades\Navi;
use function App\get_parent;
use function acf_get_attachment;
class NavHeader extends Composer
@joshuafredrickson
joshuafredrickson / wp-cli-install.sh
Created January 31, 2022 22:13
Install wp-cli on shared hosting
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
mkdir ~/bin
mv wp-cli.phar ~/bin/wp
@joshuafredrickson
joshuafredrickson / aioseo_metabox.php
Created January 19, 2022 22:06
Move All In One SEO (AIOSEO) metabox to bottom of the page
<?php
/**
* Move All In One SEO (AIOSEO) metabox to bottom of the page.
* Drop this in your functions.php file or wherever appropriate.
*
* @return string
*/
add_filter( 'aioseo_post_metabox_priority', function ($priority) {
return 'low';
});
@joshuafredrickson
joshuafredrickson / disable-plugins.php
Created January 18, 2022 20:06
Disable WordPress plugins in certain environments
<?php
/**
* Plugin Name: Disable Plugins
* Plugin URI: https://gist.github.com/joshuafredrickson/949cc0eb19d8ca2d5d7c23d8d9134ff3
* Version: 1.0.0
* Description: Disable certain plugins in certain environments
* Author: joshuafredrickson
* Author URI: https://github.com/joshuafredrickson
* License: GNU General Public License v2
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
@joshuafredrickson
joshuafredrickson / ie-to-edge.js
Created June 25, 2021 15:05
Redirect IE11 to Edge automatically
/**
* Detect IE11 and open the current window in Edge instead
*/
if (
navigator.userAgent.indexOf('MSIE') !== -1 ||
navigator.appVersion.indexOf('Trident/') > -1
) {
// Redirect to Edge
window.location = 'microsoft-edge:' + window.location.href;
@joshuafredrickson
joshuafredrickson / group-block.html
Created December 4, 2020 15:15
WP Group Block Markup
<!-- WP uses `.alignwide` and `.alignfull` for wide and full-width blocks. -->
<div class="wp-block-group alignwide">
<div class="wp-block-group__inner-container">
<div class="wp-block-columns">
<div class="wp-block-column">
<p>Paragraph text in a column.</p>
</div>
<div class="wp-block-column">
<p>The second column.</p>
</div>
@joshuafredrickson
joshuafredrickson / auth.json
Created November 1, 2020 17:49
Sample auth.json for SatisPress composer authentication
{
"http-basic": {
"satispress.domain.com": {
"username": "<apikey>",
"password": "satispress"
}
}
}