Skip to content

Instantly share code, notes, and snippets.

View hyptx's full-sized avatar

Adam J Nowak hyptx

View GitHub Profile
@hyptx
hyptx / gist:48eb7ab3334620ddf4e15fbd469f96de
Created May 12, 2025 20:39
Wordpress print pattern html
function exl_display_block_pattern_by_id($pattern_id) {
$pattern_id = intval($pattern_id); // Ensure the input is an integer.
if($pattern_id <= 0) return false;
$pattern_html = get_post_field('post_content', $pattern_id);
if($pattern_html) echo $pattern_html;
else{
echo '<p>Pattern not found with ID: ' . esc_html($pattern_id) . '</p>';
return false;
}
}
.bg-gray{background:#efefef;}
.full-bg{box-shadow:0 0 0 100vmax #efefef; clip-path: inset(0 -100vmax);}
@hyptx
hyptx / Vite Start
Created October 3, 2022 19:07
Command to create new vite project
npm create vite@latest
@hyptx
hyptx / BSPlugins
Last active September 30, 2022 00:31
Init for bootstrap plugins
//Popover
const popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'));
const popoverList = popoverTriggerList.map(function (popoverTriggerEl) {
return new Popover(popoverTriggerEl);
})
//Tooltip
const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
const tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new Tooltip(tooltipTriggerEl);
});
@hyptx
hyptx / Redirect development
Created March 31, 2022 17:23
Redirect certain pages for development
//TEMP REMOVE GO LIVE
function redirect_if_user_not_logged_in() {
global $post;
$show_live_pages = [3,46];
if(in_array($post->ID, $show_live_pages)) return;
if(is_admin()) return;
if (!is_user_logged_in() && !is_front_page()) {
wp_redirect( 'https://northernfeedandbean.com');
exit;
}
@hyptx
hyptx / RedirectAll
Created February 23, 2022 23:38
Redirect all traffic to one page or url
RewriteEngine on
RewriteCond %{HTTP_HOST} ^franchise\.seniorshelpingseniors\.com [NC]
RewriteCond %{REQUEST_URI} !^/$ [NC]
RewriteRule ^.*$ http://seniorshelpingseniorsfranchise.com/ [L]
@hyptx
hyptx / Postswithfeatured
Created February 16, 2022 17:50
Get posts with featured images
$args = array(
'post_type' => 'resources',
'posts_per_page' => -1,
'meta_query' => array(
array(
'key' => '_thumbnail_id',
'compare' => 'EXISTS'
),
)
);
@hyptx
hyptx / Hide vertical scrollbar
Created January 25, 2022 17:58
Hide scrollbars webkit
.video-left #content-right{
-ms-overflow-style: none; /* for Internet Explorer, Edge */
scrollbar-width: none; /* for Firefox */
overflow-y: scroll;
}
.content-scroller::-webkit-scrollbar {
display: none; /* for Chrome, Safari, and Opera */
}
@hyptx
hyptx / FlexVert
Created January 20, 2022 17:32
Flex Vertical Align
.v-aligner{display: flex; align-items: center; justify-content: center;}
.v-aligner-item-top{align-self: flex-start;}
.v-aligner-item-bottom{align-self: flex-end;}
@hyptx
hyptx / mincontentfooter
Created November 11, 2021 21:34
Min height to keep footer at bottom when minimal content
#main{ min-height: calc(100vh - 277px);}