Skip to content

Instantly share code, notes, and snippets.

View alexmustin's full-sized avatar

Alex Mustin alexmustin

View GitHub Profile
@alexmustin
alexmustin / form-content.html
Created February 4, 2018 21:31
WordPress AJAX Live Search of Post Title
<!-- // The HTML (could be part of page content) // -->
<input type="text" name="keyword" id="keyword" onkeyup="fetch()"></input>
<div id="datafetch">Search results will appear here</div>
@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 / functions.php
Last active October 9, 2023 11:04
Genesis - Custom SVG Logo in WordPress Customizer
<?php
//* Add support for a Custom Logo
add_theme_support( 'custom-logo', array(
'width' => 260,
'height' => 100,
'flex-width' => true,
'flex-height' => true,
) );
@alexmustin
alexmustin / functions.php
Created April 25, 2019 23:42
PHP function to Convert Hex Colors to RGBA
<?php
//* Function to convert Hex colors to RGBA
function hex2rgba( $color, $opacity = false ) {
$defaultColor = 'rgb(0,0,0)';
// Return default color if no color provided
if ( empty( $color ) ) {
return $defaultColor;
@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 / style.css
Last active February 10, 2023 02:47
Responsive / Fluid Typography -- CSS clamp() example
/*
* This will keep the element's font size between 24px and 42px.
* The middle value automatically calculates the font size between
* the Min and Max, using the browser window viewport width.
*/
.archive-title {
font-size: clamp(24px, calc(3vw + 1rem), 42px);
}
@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 29, 2022 04:39
Add Genesis Widget to the End of the_content()
<?php
//* New Widget
genesis_register_sidebar( array(
'id' => 'after-blog-content',
'name' => __( 'After Blog Content', 'hello-pro' ),
'description' => __( 'Description of the widget goes here', 'hello-pro' ),
) );
//* Add widget after the_content()