Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Laurence Bahiirwa bahiirwa

🏠
Working from home
View GitHub Profile
@bahiirwa
bahiirwa / .htaccess
Created Mar 19, 2020 — forked from johnalarcon/.htaccess
Directives for the ClassicPress .htaccess file. These directives can be copied into your exisitng .htaccess file, but they are not intended to overwrite other directives that may already be present. Read the comment before each directive below, and you'll be fine!
View .htaccess
# Code Potent's official .htaccess directives to make your ClassicPress site ROCK!
# Prevent directory browsing.
Options -Indexes
# Enable rewrite engine - you may already have these 2 lines... don't duplicate, if so.
RewriteEngine On
RewriteBase /
# Force SSL connection to everything (URLs, images, scripts, styles, etc)
@bahiirwa
bahiirwa / woocommerce.php
Created Nov 27, 2019 — forked from zulfgani/woocommerce.php
WooCommerce Addons compatibility for ClassicPress
View woocommerce.php
<?php
/**
* Plugin Name: Woo Addons Compatibility
* Plugin URI: https://github.com/zulfgani/woocommerce
* Description: A compatibility plugin for some WooCommerce addons to work with ClassicCommerce.
* Version: 10.0.1111
* Author: I have no idea
* Author URI: https://ihavenoideapleasedontquoteme.com
*
* @package Woo Addons Compatibility
@bahiirwa
bahiirwa / gist:f1830f5b16f22ac2bc52197cd84b9683
Created Aug 17, 2019 — forked from Marian0/gist:4d689c33164bc9daf0e1
Disable wordpress Frontend by htaccess
View gist:f1830f5b16f22ac2bc52197cd84b9683
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !/wp-admin
RewriteCond %{REQUEST_URI} !/wp-includes
RewriteCond %{REQUEST_URI} !/wp-login\.php$
RewriteCond %{REQUEST_URI} !/wp-content
RewriteCond %{REQUEST_URI} !/feed
@bahiirwa
bahiirwa / hide-wp5-updates.php
Created Jul 6, 2019 — forked from nylen/hide-wp5-updates.php
Keep a WordPress site on 4.9.x with security updates
View hide-wp5-updates.php
<?php
/**
* Plugin Name: Ignore WP5 Updates
* Plugin URI: https://gist.github.com/nylen/44adecb537d65bd4c64be8007cd1523b
* Description: Keep a site on WP 4.9.x with security updates
* Version: 1.1.0
* Author: James Nylen
* License: GPLv2 - https://www.gnu.org/licenses/gpl-2.0.html
*/
View wp-graphql-documentation-examples.php
add_action( 'graphql_register_types', 'register_dog_type' );
function register_dog_type() {
register_graphql_object_type( 'Dog', [
'description' => __( "Man's best friend", 'your-textdomain' ),
'fields' => [
'name' => [
'type' => 'String',
'description' => __( 'The name of the dog', 'your-textdomain' ),
],
@bahiirwa
bahiirwa / composer on mac
Last active Jun 29, 2019
Update PHP to 7.2 & Add composer on mac
View composer on mac
# Update php
# https://medium.com/zenchef-tech-and-product/how-to-upgrade-your-version-of-php-to-7-0-on-macos-sierra-e1bfdea55a63
curl -s http://php-osx.liip.ch/install.sh | bash -s 7.2
export PATH=/usr/local/php5/bin:$PATH
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
composer --version
View wp-admin-bar-tweaks.php
Disable the WordPress Admin Bar for all Users and Visitors
Turn off the toolbar with one simple line.
view plain
/*
* Disable the WordPress Admin Bar for all Users and Visitors
*/
remove_action( 'init', '_wp_admin_bar_init' );
^ top
Enable the WordPress Admin Bar for admins only
View Settings-api-fix
<?php
/*
Plugin Name: Query APIs
Plugin URI: https://omukiguy.com
Description: Plugin Working with External API calls in WordPress.
Version: 0.1.0
Author: Laurence Bahiirwa
Author URI: https://omukiguy.com/
License: GPL-3.0+
License URI: http://www.gnu.org/licenses/gpl-2.0.txt
View geblock.js
/**
* Internal block libraries
*/
const { __ } = wp.i18n;
const { registerBlockType } = wp.blocks;
const { RichText } = wp.editor;
/**
* Register block
*/
@bahiirwa
bahiirwa / push.php
Last active Aug 22, 2018
push notification to external URL
View push.php
<?php
function wp_plugin_event_handler () {
global $post;
$url = 'https://us-central1-smackapp-7eab7.cloudfunctions.net/sendNotification';
if( get_post_type( $post->ID ) == 'post' ) {