Skip to content

Instantly share code, notes, and snippets.

View alexmustin's full-sized avatar

Alex Mustin alexmustin

View GitHub Profile
@alexmustin
alexmustin / _singlePost.scss
Created January 13, 2024 22:35
Sample SASS files
body.custom-single {
.site-container {
.site-inner {
padding: 0;
.entry-header {
@alexmustin
alexmustin / acf-blocks.php
Created July 9, 2023 20:09
ACF Blocks - custom SVG icon
<?php
// Example: icon with SVG code.
acf_register_block_type( array(
'name' => 'image-with-text',
'title' => __('Image with Text'),
'description' => __('A custom block for Image with Text.'),
'render_template' => 'template-parts/blocks/image-with-text.php',
'icon' => '<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="none" d="M0 0h24v24H0V0z" /><path d="M19 13H5v-2h14v2z" /></svg>',
'category' => 'ap-blocks',
@alexmustin
alexmustin / functions.php
Created October 6, 2022 19:26
Function to determine if a Hex color is "light" or "dark"
<?php
function isColorLightOrDark( $color ) {
$red = hexdec(substr($color, 1, 2));
$green = hexdec(substr($color, 3, 2));
$blue = hexdec(substr($color, 5, 2));
$result = (($red * 299) + ($green * 587) + ($blue * 114)) / 1000;
if ( intval($result) > 128 ) {
$lightdark = "light";
} else {
$lightdark = "dark";
@alexmustin
alexmustin / style.scss
Last active September 20, 2022 20:34
CSS background cover mobile iOS fix
/**
* This applies to Genesis Blocks that have
* a 'fixed' background image applied.
*/
.gb-has-parallax {
/**
* This is the fix for mobile (iOS).
* It displays as a normal background image which fills
* the container and scrolls with the content.
@alexmustin
alexmustin / style.css
Created September 14, 2022 19:30
Slick Slider - make all Slides the same height
.slick-track {
display: flex !important;
}
.slick-slide {
height: auto;
}
@alexmustin
alexmustin / functions.php
Last active August 18, 2022 23:00
Custom Genesis Pagination functions and styles
<?php
// CUSTOM LABEL: PREVIOUS BUTTON.
add_filter( 'genesis_prev_link_text', 'modify_previous_link_text' );
function modify_previous_link_text($text) {
$text = '< PREV';
return $text;
}
// CUSTOM LABEL: NEXT BUTTON.
@alexmustin
alexmustin / readme.md
Last active June 19, 2022 07:09
ConvertKit - How to create a Visual Automation for a Giveaway

ConvertKit Giveaway Automation

The following is an example of how to incorporate a ConvertKit Automation for a Giveaway.

This example assumes you have setup a Form on ConvertKit (called 'Giveaway Form').

1. Setup the Visual Automation

The following is a rough diagram of a sample Visual Automation. An explanation is provided after the diagram.

      [WEBSITE FORM]
@alexmustin
alexmustin / functions.php
Created April 5, 2022 05:48
WordPress: Enable the Block-based Widget Editor
<?php
//* Enable the block-based widget editor
add_filter( 'use_widgets_block_editor', '__return_true' );
@alexmustin
alexmustin / shortcode.php
Created December 2, 2021 21:20
A shortcode to display the latest release number for a provided GitHub repository
<?php
/**
* Displays the latest release number from a provided GitHub repository.
*
* Example usage: [show_repo_version_number repo="alexmustin/woo-custom-emails-per-product"]
*
* @param array $atts An array of shortcode attributes.
* @return string $output A string of text including the release number.
*/
function show_repo_version_number_function( $atts ) {
@alexmustin
alexmustin / _grid.scss
Last active November 11, 2021 06:33
CSS Grid - responsive 3-column grid example
.products-wrap {
display: grid;
justify-content: space-between;
grid-template-columns: repeat(auto-fill, 100%);
@include media( $screen--m ) {
grid-template-columns: repeat(auto-fill, 48%);
grid-gap: 2%;
}