Skip to content

Instantly share code, notes, and snippets.

View NichlasB's full-sized avatar

Nichlas Brandon NichlasB

View GitHub Profile
@NichlasB
NichlasB / block-role-admin-access.php
Created July 5, 2017 08:44
Block Admin Access for Specified User Roles
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* block-role-admin-access.php
*/
function cf_block_role_admin_access() {
@NichlasB
NichlasB / dequeue-assets.php
Created June 27, 2017 18:19
Conditionally Load WordPress Plugin Assets
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* dequeue-assets.php
* Resource: http://orbitingweb.com/blog/preventing-plugins-from-loading-js-css-on-all-pages/
*/
//* Finding handles for plugins
@NichlasB
NichlasB / custom-genesis-sitemap.php
Created June 22, 2017 21:38
Customize Genesis Framework Sitemap
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* custom-genesis-sitemap.php
*/
add_filter( 'genesis_sitemap_output', 'vmf_sitemap' );
function vmf_sitemap() {
@NichlasB
NichlasB / custom-category-redirects.php
Created June 22, 2017 21:36
Redirect Category Slugs
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Redirect categories to pages
*/
function cf_redirect_categories() {
if ( is_category( 'appliances' ) ) {
@NichlasB
NichlasB / display-chosen-categories.php
Last active June 22, 2017 21:56
Display Chosen Categories on WordPress Blog Page
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* display-chosen-categories.php
*/
//* Display only chosen categories on blog page
function cf_display_chosen_categories( $query ) {
@NichlasB
NichlasB / exclude-blog-categories.php
Last active June 22, 2017 21:56
Exclude Categories from WordPress Blog Page
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* exclude-blog-categories.php
*/
function cf_exclude_chosen_categories( $query ) {
@NichlasB
NichlasB / password-reset-link-duration.php
Last active June 22, 2017 21:53
Set Duration for Password Reset Link
@NichlasB
NichlasB / scrollbar-styling.css
Created April 6, 2017 12:37
Customize the Browser Scrollbar
/** BROWSER SCROLLBAR **/
/* Scrollbar Styling */
::-webkit-scrollbar {
width: 11px;
}
/* The new scrollbar will have a flat appearance with the set background color */
::-webkit-scrollbar-track {
background-color: #FFD600;
@NichlasB
NichlasB / create-admin-user.php
Last active June 22, 2017 21:47
Create a new WordPress admin user via functions.php
<?php
/* Copy the Content Below this line - DO NOT INCLUDE THE <?php ABOVE */
// Add snippet to functions.php file
function cf_new_admin_account() {
$user = 'admin';
$pass = 'password';
@NichlasB
NichlasB / sftp-new-user.sh
Last active June 17, 2020 14:48
Shell Script for Creating EasyEngine Server SFTP User
#!/bin/bash
# WARNING: This script must be run manually to create a new SFTP user. Remember to change the new user's password.
# NOTICE: Make sure first instance of PasswordAuthentication is set to "no" $ sudo nano /etc/ssh/sshd_config
# REQUIREMENT: Make sure bindfs is installed $ sudo apt-get -y install bindfs
####
## Gist: https://gist.github.com/NichlasB/9b9c79ff8e31f48ad19f652b71baf8f6
## Resource: https://easyengine.io/docs/chroot-sftp-easyengine/
## Resource: https://www.howtoforge.com/restricting-users-to-sftp-plus-setting-up-chrooted-ssh-sftp-debian-squeeze