Skip to content

Instantly share code, notes, and snippets.

View flexseth's full-sized avatar

Seth Miller flexseth

View GitHub Profile
@flexseth
flexseth / disable-default-admin-bar.php
Created January 29, 2020 20:24
Disable default admin bar in WordPress
<?php
add_action("user_register", "set_user_admin_bar_false_by_default", 10, 1);
function set_user_admin_bar_false_by_default($user_id) {
update_user_meta( $user_id, 'show_admin_bar_front', 'false' );
}
@flexseth
flexseth / one-category-per-woocommerce-product.php
Last active November 6, 2019 15:38
Convert WooCommerce category checklist selection to a radio button, enforcing only one category per product
<?php
/*
* Change WooCommerce product category selection
* from checkbox to radio button, enforcing only one category
*/
function fp_wc_checktoradio(){
echo '<script type="text/javascript">jQuery("#product_catchecklist input").each(function(){this.type="radio"});</script>';
}
<script>
$("select"). removeAttr("multiple");
</script>
@flexseth
flexseth / simple-social-icon-defaults.php
Created September 15, 2019 17:12
Simple Social Icon Default Styles
<?php
add_filter( 'simple_social_default_styles', 'fp_social_default_styles' );
/**
* Simple Social Icon Defaults.
*
* @param array $defaults
* @return array $args
*
* @since 1.0.0
@flexseth
flexseth / markup.html
Created July 25, 2019 17:45
Slide Out, Full Width, Responsive Navigation Menu
<div id="mySidenav" class="sidenav">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">&times;</a>
<a href="#">About</a>
<a href="#">Services</a>
<a href="#">Clients</a>
<a href="#">Contact</a>
</div>
<!-- Use any element to open the sidenav -->
<span onclick="openNav()">open</span>
@flexseth
flexseth / font-awesome-replace-plain-text.css
Last active July 22, 2019 15:16
Font Awesome substitution for Plain Text with HTML + CSS online (uses text-indent)
li {
display:block;
position:relative;
text-indent: -100%;
white-space: nowrap;
overflow: hidden;
}
li::after {
content: "visible pseudo-element";
@flexseth
flexseth / psd-uploads.php
Created July 18, 2019 21:45
Allow Photoshop files to be uploaded to the media gallery in word press
<?php
function fp_photoshop_myme_types($mime_types){
$mime_types['psd'] = 'image/vnd.adobe.photoshop'; //Adding photoshop files
return $mime_types;
}
add_filter('upload_mimes', 'fp_photoshop_myme_types', 1, 1);
@flexseth
flexseth / Demo-Gravity-Form.json
Created July 18, 2019 20:43
Demo Gravity Form
{
"title": "My test form",
"description": "",
"labelPlacement": "top_label",
"descriptionPlacement": "below",
"button": {
"type": "text",
"text": "Submit",
"imageUrl": ""
},
@flexseth
flexseth / todo-pm-wordpress.php
Created July 16, 2019 21:14
Todo Custom Post Type for Project Management (PM) on WordPress
<?php
function fp_register_my_cpts_todo() {
/**
* Post Type: Todos.
*/
$labels = array(
"name" => __( "Todos", "american-idea-foundation" ),
"singular_name" => __( "Todo", "american-idea-foundation" ),
@flexseth
flexseth / jetpack-infinite-scroll-genesis-sample.php
Created July 10, 2019 22:28
Add Jetpack's Infinite Scroll support to Genesis Sample child theme
<?php
add_theme_support( 'infinite-scroll', array(
'container' => 'genesis_entry_content',
'footer' => 'genesis_entry_footer',
) );