Skip to content

Instantly share code, notes, and snippets.

View gdnwebmedia's full-sized avatar

Robert Galofre gdnwebmedia

View GitHub Profile
@gdnwebmedia
gdnwebmedia / hero-with-max-width.css
Created March 25, 2024 14:08
Limit max-width for hero background images on wide monitors
/*
This is to be used using Bricks & Automatic CSS already installed. Otherwise, replace %root% with the element/class/ID and add values to existing root variables like var(--radius-m).
*/
%root% {
width: 100%;
max-width: 90em;
}
@media screen and (min-width: 1600px) {
@gdnwebmedia
gdnwebmedia / general-animations.css
Last active September 28, 2023 13:40
General CSS snippets for Bricks Builder
/*
Set the CSS transition to 0.4s right above the custom CSS block
*/
%root%:hover { transform: scale(1.03); }
/* subtle shadow */
%root% {
box-shadow:
0px 0.1px 0.9px rgba(0, 0, 0, 0.014),
0px 0.3px 2.1px rgba(0, 0, 0, 0.02),
@gdnwebmedia
gdnwebmedia / add_role_to_body_class.php
Created August 29, 2023 03:33
Add current user role to the body class
<?php
add_filter( 'body_class', 'add_role_to_body_class' );
function add_role_to_body_class( $classes ) {
// Get the current user's roles
$user_roles = wp_get_current_user()->roles;
// Loop through the roles and add them to the body class
foreach ($user_roles as $role) {
:root {
--transition-n: 0.4s;
}
.an-hover-scale {
transition-duration: var(--transition-n);
}
.an-hover-scale:hover {
transform: scale(1.05,1.05);
transition-duration: var(--transition-n);
@gdnwebmedia
gdnwebmedia / wpmudev_hustle_media_library_fix.php
Last active June 7, 2021 21:30
When active, WPMUDEV hustle breaks the media library (v 4.4.4 or older) This is a temp fix.
<?php
// wpmudev_hustle_media_library_fix
// Add this to the functions.php file or use Advanced Scripts to add it when plugins are loaded
function wpmudev_hustle_dequeue_script() {
if( isset( $_GET['ct_builder'] ) ){
wp_dequeue_script( 'hui_scripts' );
wp_dequeue_script( 'hustle_front' );
}
}
add_action( 'wp_print_scripts', 'wpmudev_hustle_dequeue_script', 100 );
@gdnwebmedia
gdnwebmedia / branda-custom-login-AbstractTag-customizations.css
Created May 27, 2021 13:36
Custom modifications to enhance Branda's AbstractTag Custom Login Template
html body {
display: flex;
align-items: stretch;
align-content: flex-start;
background-position: 200px 50%;
background-color: #ffffff;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
@gdnwebmedia
gdnwebmedia / php-clean-wp_query-output.php
Created May 16, 2021 18:14
Readable version of wp_query output
printf( '<pre>%s</pre>', print_r( $wp_query, 1 ) );
@gdnwebmedia
gdnwebmedia / wp-search-post-and-pages-only.php
Last active March 20, 2021 15:26
Search only WordPress Posts & pages
<?php
// Search only Posts or Pages
//Exclude pages from WordPress Search
function wpb_search_filter( $query ) {
if ( ! is_admin() && $query->is_main_query() && $query->is_search() ) {
$query->set( 'post_type', [ 'post', 'page' ] );
}
}
@gdnwebmedia
gdnwebmedia / wp-hide-related-videos-sitewide.php
Created March 4, 2021 14:57
Add modestbranding to WP Gutenberg Video Blocks
@gdnwebmedia
gdnwebmedia / retrieves-thumbnail-youtube.php
Last active February 26, 2021 04:30
Retrieves the thumbnail from a youtube or vimeo video
<?php
/**
* Retrieves the thumbnail from a youtube or vimeo video
* @param - $src: the url of the "player"
* @return - string
*
**/
function get_video_thumbnail( $src ) {
$url_pieces = explode('/', $src);