Skip to content

Instantly share code, notes, and snippets.

View chancecorbeil's full-sized avatar
🐢
Turtle Stuff

Chance Corbeil chancecorbeil

🐢
Turtle Stuff
View GitHub Profile
<script>
var maxHeight = 0;
$("div").each(function(){
if ($(this).height() > maxHeight) { maxHeight = $(this).height(); }
});
$("div").height(maxHeight);
<script>
// * Event trigger on class change
// Watch an element to see if a specific class is added
// If so, trigger event
// This function can be used on multiple targets
function onClassChange(element, callback) {
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
// * Primary Color
$primary: #6d597a;
$secondary: #b56576;
$accent: #e56b6f;
// Primary - Lighten
$primary-lighten-10: mix(white, $primary, 10%);
$primary-lighten-20: mix(white, $primary, 20%);
$primary-lighten-30: mix(white, $primary, 30%);
$primary-lighten-40: mix(white, $primary, 40%);
// Add horizontal scrollbar on top of block
.block-container,
.block {
transform:rotateX(180deg);
-ms-transform:rotateX(180deg); /* IE 9 */
-webkit-transform:rotateX(180deg); /* Safari and Chrome */
overflow-x: auto;
}
@chancecorbeil
chancecorbeil / H1 svg with alt attribute for home page only.php
Created February 11, 2022 19:51
Use a svg as the h1 on the home page using screen reader only text inside the link tag. Remove heading tag on any page that is not the home page. For WordPress websites.
<!-- Logo (SVG) -->
<?php
if (is_front_page()) {
echo '<h1 class="site-logo"><a href="' . esc_url( home_url( '/' ) ) . '">';
get_template_part('images/logo/logo-base-theme.svg');
echo '<span class="is-sr-only">The h1 and logo</span></a></h1>';
} else {
echo '<a href="' . esc_url( home_url( '/' ) ) . '" class="site-logo">';
get_template_part('images/logo/logo-base-theme.svg');
echo '<span class="is-sr-only">The logo</span></a>';
@chancecorbeil
chancecorbeil / H1 png with alt attribute for home page only.php
Created February 11, 2022 19:35
Use a png as the h1 on the home page using the alt attribute. Remove heading tag on any pagethat is not the home page. For WordPress websites.
<!-- Logo -->
<?php
if (is_front_page()) {
echo '<h1 class="site-logo"><a href="' . esc_url( home_url( '/' ) ) . '"><img src="' . get_stylesheet_directory_uri() . '/images/logo/logo.png"
alt="The H1 Heading and Logo" />
</a></h1>';
} else {
echo '<a href="' . esc_url( home_url( '/' ) ) . '" class="site-logo"><img src="' . get_stylesheet_directory_uri() . '/images/logo/logo.png"
alt="The Logo" />
function tcp_list_timetable_route_ids( $args = array() ) {
if ( ! post_type_exists('route') ) {
// Fail silently
return;
}
$defaults = array(
'before' => '<div class="tcp_route_list">',
'after' => '</div>',
'sep' => ' ',
'use_color' => false, // TODO - doesn't work
// Load custom fields using a post id
$postid = 315 ; // post ID 315
$post = get_post( $postid ); // Use the post ID to get the post data
echo $postid; // The post ID
echo $post->post_title; // The post title
echo $post->route_id; // The custom field
<?php
$postid = get_the_ID();
// echo $postid; // TEST
?>