Skip to content

Instantly share code, notes, and snippets.

View jonschr's full-sized avatar

Jon Schroeder jonschr

View GitHub Profile
View style.css
.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
View script.js
// 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);
View functions.php
<?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;
View functions.php
<?php
function show_takeout_info() {
$food_drink = get_field( 'food_drink' );
// bail if no takeout info
if ( !isset( $food_drink['take_out'] ) )
return;
View functions.php
/**
* 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() ) {
View functions.php
<?php
function elodin_section_block_get_the_colors_formatted_for_acf_from_theme_support() {
// get the colors
$color_palette = current( (array) get_theme_support( 'editor-color-palette' ) );
// bail if there aren't any colors found
if ( !$color_palette )
return;
View gist:b7802d145c34000063ce36cbd7bfcbbb
// get the palette from the theme defaults, as defined in theme.json
$color_palette = [];
if ( class_exists( 'WP_Theme_JSON_Resolver' ) ) {
$settings = WP_Theme_JSON_Resolver::get_theme_data()->get_settings();
if ( isset( $settings['color']['palette']['theme'] ) ) {
$color_palette = $settings['color']['palette']['theme'];
}
}
// do stuff with $color_palette
View apartment-sync.php
// This constant should be defined in the main file for the plugin, even if the rest of this code is loaded elsewhere
define( 'APARTMENTSYNC_DIR', plugin_dir_path( __FILE__ ) );
use AC\ListScreenRepository\Storage\ListScreenRepositoryFactory;
use AC\ListScreenRepository\Rules;
use AC\ListScreenRepository\Rule;
add_filter( 'acp/storage/repositories', function( array $repositories, ListScreenRepositoryFactory $factory ) {
//! Change $writable to true to allow changes to columns for the content types below
$writable = false;
View staff-plugin.php
// This constant should be defined in the main file for the plugin, even if the rest of this code is loaded elsewhere
define( 'ELODIN_STAFF_DIR', plugin_dir_path( __FILE__ ) );
use AC\ListScreenRepository\Storage\ListScreenRepositoryFactory;
use AC\ListScreenRepository\Rules;
use AC\ListScreenRepository\Rule;
add_filter( 'acp/storage/repositories', function( array $repositories, ListScreenRepositoryFactory $factory ) {
//! Change $writable to true to allow changes to columns for the content types below
$writable = false;
View error-codes-for-properties.txt
2021-03-29 07:50:03 Yardi returned error code 1050 for property 1010Linc.
2021-03-29 07:50:04 Yardi returned error code 1070 for property 101914.
2021-03-29 07:50:04 Yardi returned error code 1070 for property 102714.
2021-03-29 07:50:04 Yardi returned error code 1050 for property 1031Port.
2021-03-29 07:50:04 Yardi returned error code 1050 for property 103314th.
2021-03-29 07:50:04 Yardi returned error code 1050 for property 1041gr.
2021-03-29 07:50:05 Yardi returned error code 1070 for property 106813.
2021-03-29 07:50:05 Yardi returned error code 1050 for property 108013th.
2021-03-29 07:50:05 Yardi returned error code 1070 for property 1085-3.
2021-03-29 07:50:06 Yardi returned error code 1050 for property 1085b5.