Skip to content

Instantly share code, notes, and snippets.

View jonschr's full-sized avatar

Jon Schroeder jonschr

View GitHub Profile
<?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() ) {
<?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;
// 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
// 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;