Skip to content

Instantly share code, notes, and snippets.

View karks88's full-sized avatar

Eric Karkovack karks88

View GitHub Profile
@karks88
karks88 / footer-contact-info.html
Last active January 22, 2023 13:58
A sample WordPress block template part
@karks88
karks88 / theme.json
Created September 18, 2021 13:54
theme.json for Custom Color Palette
{
"version": 1,
"settings": {
"color": {
"custom": false,
"customGradient": false,
"gradients": [],
"link": false,
"palette": [
{
/* Flexbox Columns */
.flex-columns {
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-flex-wrap: nowrap;
@karks88
karks88 / flexgrid.css
Last active March 29, 2021 11:46
Flexbox Grid with Fallbacks (requires Modernizr)
/* Flexbox Columns */
.flex-columns {
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-flex-wrap: nowrap;
@karks88
karks88 / my-wp-add-custom-block-patterns.php
Last active August 24, 2020 17:33
Creating a custom Gutenberg block pattern for WordPress.
<?php
/*
Plugin Name: My WP Custom Block Patterns
Description: Adds a custom block pattern to the Gutenberg block editor.
Version: 1.0
Author: Eric Karkovack
Author URI: https://www.speckyboy.com
*/
@karks88
karks88 / wp-custom-color-pallete-front-end.css
Last active August 18, 2020 15:22
Turn off the ability to use the custom color picker in the WordPress Gutenberg editor. Then, define your own custom color palette.
/* Define Custom Colors on the Front End */
/* white */
.has-white-color {
color:#FFFFFF;
}
.has-white-background-color {
background-color:#FFFFFF;
}
@karks88
karks88 / wordpress-secondary-navigation-script.php
Created July 2, 2020 19:01
This script will look at the current page and serve up a list of sibling pages.
<?php
// Show child or sibling pages in left column.
if(!$post->post_parent){
// will display the subpages of this top level page
$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0&sort_column=menu_order");
}
else{
if($post->ancestors) {
// now you can get the the top ID of this page
<?php
/*
Plugin Name: WooCommerce Order Surcharge - Percentage
Plugin URI: https://www.karks.com
Description: Adds a percentage-based surcharge to every order. Based on WooCommerce Snippet: https://docs.woocommerce.com/document/add-a-surcharge-to-cart-and-checkout-uses-fees-api/
Version: 1.0
Author: Eric Karkovack
Author URI: https://www.karks.com
*/
<?php
/*
Plugin Name: WooCommerce Order Surcharge
Plugin URI: https://www.karks.com
Description: Adds a flat surcharge to every order. Based on WooCommerce Snippet: https://docs.woocommerce.com/document/add-a-surcharge-to-cart-and-checkout-uses-fees-api/
Version: 1.0
Author: Eric Karkovack
Author URI: https://www.karks.com
Code culled from https://docs.woocommerce.com/document/add-a-surcharge-to-cart-and-checkout-uses-fees-api/
@karks88
karks88 / block-notification-bar.php
Last active May 12, 2020 17:34
A simple notification bar using the Block Lab WordPress plugin.
<div style="margin:30px auto; padding:5px 10px; background:<?php block_field( 'background-color' ); // Background Color (Color Field) ?>">
<span style="color:<?php block_field( 'text-color' ); // Text Color (Color Field) ?>"><?php block_field( 'message' ); // Message (Text Field) ?></span>
</div>