Skip to content

Instantly share code, notes, and snippets.

View jonschr's full-sized avatar

Jon Schroeder jonschr

View GitHub Profile
function rentfetch_available_units_label( $number ) {
$number = intval( $number );
if ( 0 === $number || empty( $number ) ) {
$available = 'No units available';
} elseif ( 1 === $number ) {
$available = '1 unit available';
} else {
$available = $number . ' units available';
function singular_template_floorplans() {
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
global $post;
echo '<div class="single-floorplans-container-outer container-current-floorplan-info">';
@jonschr
jonschr / customize.css
Created July 10, 2024 04:01
Add sold out banner
/* Floor Plans Sold Out Red Banner */
.floorplans-loop .type-floorplans.no-units-available:before {
background: #E4440F;
content: "Sold out";
top: 50%;
left: 50%;
position: absolute;
z-index: 10;
padding: 12px 17px;
color: white;
<?php
/**
* The template used for displaying page content in page.php
*
* @package Genesis Block Theme
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
//* Disable fullscreen mode
add_action( 'enqueue_block_editor_assets', 'elodin_disable_fullscreen_mode' );
function elodin_disable_fullscreen_mode() {
if ( !is_admin() )
return;
$script = "
jQuery( window ).load(function() {
.single-properties-wrap {
width: 100%;
max-width: 1200px;
margin-left: auto;
margin-right: auto;
}
@jonschr
jonschr / script.js
Created July 25, 2023 20:10
Force oembed to not show related videos
// Get all the iframes present on the page
const iframes = document.querySelectorAll('iframe');
// Loop through each iframe to check if it contains "youtube.com" in its src
for (const iframe of iframes) {
const src = iframe.getAttribute('src');
if (src.includes('youtube.com')) {
// Append ?rel=0 to the existing src
const modifiedSrc = src + '?rel=0';
iframe.setAttribute('src', modifiedSrc);
<?php
remove_action( 'rentfetch_do_single_properties', 'rentfetch_single_property_basic_info', 30 );
add_action( 'rentfetch_do_single_properties', 'bankier_single_property_basic_info', 30 );
function bankier_single_property_basic_info() {
// bail if this section isn't set to display
$single_property_components = get_field( 'single_property_components', 'option' );
if ( $single_property_components['enable_basic_info_display'] === false )
return;
<?php
function show_takeout_info() {
$food_drink = get_field( 'food_drink' );
// bail if no takeout info
if ( !isset( $food_drink['take_out'] ) )
return;
/**
* Force first page of results in archives to an odd number, later pages to an even number
*/
add_action( 'pre_get_posts', 'elodin_change_posts_number_home_page_to_odd' );
function elodin_change_posts_number_home_page_to_odd( $query ) {
// only modify the query if it's the main query
if ( !is_admin() && $query->is_main_query() ) {