Skip to content

Instantly share code, notes, and snippets.

View nszumowski's full-sized avatar
🏠
doin' stuff

Nick Szumowski nszumowski

🏠
doin' stuff
  • Burlington, VT
  • 00:25 (UTC -05:00)
View GitHub Profile
@nszumowski
nszumowski / functions.php
Last active August 30, 2018 14:23
Hide menu items for Editor role in WordPress
<?php
// add editor the privilege to edit theme
// comment out after reloading site
// get the the role object
$role_object = get_role( 'editor' );
// add $cap capability to this role object
$role_object->add_cap( 'edit_theme_options' );
// comment out above after reloading site
@nszumowski
nszumowski / merge.php
Last active August 18, 2018 15:34
Merge Multiple WP_Query Based on Post ID
<?php
//setup your args with extra parameter fields => ids
$cat_query_args = array(
'category__in' => 123,
'fields' => 'ids',
);
$meta_query_args = array(
'meta_key' => 'featured_post',
'meta_value' => 'yes',
@nszumowski
nszumowski / functions.php
Last active August 18, 2018 14:53
Set Default WordPress Image Editor to GD Library
<?php
function xxx_image_editor_default_to_gd( $editors ) {
$gd_editor = 'WP_Image_Editor_GD';
$editors = array_diff( $editors, array( $gd_editor ) );
array_unshift( $editors, $gd_editor );
return $editors;
}
add_filter( 'wp_image_editors', 'xxx_image_editor_default_to_gd' );
@nszumowski
nszumowski / functions.php
Created August 9, 2018 20:25
Apply Custom CSS to WordPress Admin
<?php
// Admin Custom CSS (located in child theme)
add_action( 'admin_enqueue_scripts', 'admin_custom_css' );
function admin_custom_css() {
wp_enqueue_style( 'admin_custom_css', get_stylesheet_directory_uri() . '/admin.css', false, '1.0.0' );
}
@nszumowski
nszumowski / functions.php
Last active August 9, 2018 18:16
Remove fields from WP Job Manager job submission form
<?php
// Remove fields from job submission form - https://wpjobmanager.com/customization-snippets/#removeField
add_filter( 'submit_job_form_fields', 'remove_job_form_fields' );
function remove_job_form_fields( $fields ) {
// remove location
unset($fields['job']['job_location']);
@nszumowski
nszumowski / cmder-aliases-windows.md
Last active August 9, 2018 18:18
Create CMDER Aliases for Windows

In C:\cmder\config\user-aliases.cmd (or wherever your cmder root is), add line:

projects=cd ""C:\Users\Username\Web Projects""

or in cmder type:

alias projects=cd ""C:\Users\Username\Web Projects""
@nszumowski
nszumowski / github-ssh-windows.md
Last active July 24, 2018 14:56
Setting up SSH for GitHub on Windows

Rather than using default location and filenames like id_rsa and id_rsa.pub in .ssh:

Create a new file in .ssh directory (C:/Users/Username/.ssh) named "config", remove file extension if the editor adds one.

Inside "config" file add:

Host github github.com
    HostName github.com
    IdentityFile drive:/path/to/key/filename
 User git
@nszumowski
nszumowski / cmder-vscode.md
Last active May 12, 2018 15:57
Cmder shell in VScode

Q: Can I use Cmder's shell with the terminal on Windows?

A: Yes, to use the Cmder shell in VS Code, you need to create a vscode.bat file in your cmder path with the following contents:

@echo off
SET CurrentWorkingDirectory=%CD%
SET CMDER_ROOT=C:\cmder (your path to cmder)
CALL "%CMDER_ROOT%\vendor\init.bat"
CD /D %CurrentWorkingDirectory%
@nszumowski
nszumowski / gist:ba90baa4fdf0c4cf9d67120c76629606
Created February 27, 2018 18:19
NPM Babel Javascript ES6 > ES5
1. Initialize your project using npm init and create a directory called src
2. Install babel dependencies by running
npm install babel-cli -D
npm install babel-preset-env -D
3. Create a .babelrc file inside your project and add the following code inside it:
{
"presets": ["env"]
@nszumowski
nszumowski / generatepress-header-hook.php
Created September 20, 2017 19:45
Before Header Content hook for GeneratePress
<?php if(is_home() || is_page('home')) { ?>
<div class="site-logo">
<a href="http://www.bizconvt.com/" title="BizCon VT" rel="home">
<img class="header-image" src="http://www.bizconvt.com/wp-content/uploads/2017/09/BizCon-logo-white_green-150x64.png" alt="BizCon VT" title="BizCon VT">
</a>
</div>
<?php } else { ?>
<div class="site-logo">
<a href="http://www.bizconvt.com/" title="BizCon VT" rel="home">
<img class="header-image" src="http://www.bizconvt.com/wp-content/uploads/2017/09/BizCon-logo-150x64.png" alt="BizCon VT" title="BizCon VT">