This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Filters the uploads directory to use a custom structure for select post types | |
| */ | |
| add_filter('upload_dir', 'filter_uploads_dir_by_posttype'); | |
| function filter_uploads_dir_by_posttype( $upload ) { | |
| global $post; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Disable XML RPC | |
| add_filter( 'xmlrpc_enabled', '__return_false' ); | |
| // Disable Generator | |
| add_filter('the_generator', '__return_empty_string'); | |
| //Disable emojis | |
| add_action( 'init', 'dw_disable_emojis' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Try to get an alternate thumbnail from an image url field | |
| add_filter( 'post_thumbnail_url', 'PREFIX_filter_post_thumbnail_url', 10, 2 ); | |
| function PREFIX_filter_post_thumbnail_url( $thumbnail_url, $post){ | |
| if ( empty($thumbnail_url) || $thumbnail_url == false ) { | |
| // get the first instance of meta field 'property_image' | |
| $image = get_post_meta($post->ID, 'property_image', true); | |
| $image = is_array($image)? $image[0] : $image; | |
| $thumbnail_url = ($image !== '') ? $image : ''; | |
| } | |
| return $thumbnail_url; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * register "get_numeric" shortcode | |
| * utility shortcode to output a numeric custom field value in a number format | |
| * uses the php function: number_format(number,decimals,decimalpoint,separator) | |
| * defaults to comma separator and 0 decimals | |
| * example: | |
| * [get_numeric id="123" field="price" before="$" after=" USD" decimals="2" decimalpoint="." separator=","] | |
| * field = '100000.1233' out = "$100,000.12 USD" | |
| */ | |
| add_shortcode('get_numeric', 'PREFIX_get_numeric_field'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * filter meta-data returned for certain posts | |
| * | |
| * This makes it possible to access dynamic data related to a post object by simply referencing `$post->foo`. | |
| * That keeps the calling code much cleaner than if it were to have to do something like | |
| * `$foo = some_custom_logic( get_post_meta( $post->ID, 'bar', true ) ); echo esc_html( $foo )`. | |
| * | |
| * @param mixed $value | |
| * @param int $post_id | |
| * @param string $property_key |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| if ( !defined( 'ABSPATH' ) ) exit; | |
| /*Plugin Name: Widget Custom Classes | |
| Description: This plugin adds a class field to the widgets section | |
| Version: 1.0 | |
| Tested up to: 5.6 | |
| */ | |
| class WidgetClassField{ | |
| public function __construct() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- Form submit success --> | |
| <script> | |
| document.addEventListener( 'wpcf7mailsent', function( event ) { | |
| // GA4 event with recommended standard dimensions | |
| if ( event.hasOwnProperty('detail') && typeof gtag !== "undefined" ) { | |
| gtag('event', 'generate_lead', { | |
| 'form_name': 'Contact Form', // change this to a recognizable name for your form | |
| 'form_id': event.detail.contactFormId | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery( document ).ready(function(){ | |
| // the "on" listener must be added within the document ready() block, otherwise it does not fire. | |
| jQuery( document ).on('submit_success', function( event ) { | |
| //console.log('submit_success', event.target.name); | |
| // test for existence of gtag to prevent loading | |
| if (typeof gtag !== 'undefined') { | |
| gtag('event', 'generate_lead', { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script src="https://cdn.jsdelivr.net/npm/simple-parallax-js@5.6.2/dist/simpleParallax.min.js"></script> | |
| <script> | |
| var parallaxBg = document.querySelectorAll('.parallax-bg img'); | |
| new simpleParallax(parallaxBg, { | |
| customWrapper: '.elementor-widget-container', | |
| orientation: 'down', | |
| scale: 1.25, | |
| delay: 0.3, | |
| transition: 'cubic-bezier(0,0,0,1)', | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery(document).ready(function() { | |
| jQuery(document).on('fluentform_submission_success', function( event ) { | |
| if (typeof gtag !== 'undefined') { | |
| gtag('event', 'form_submit_success', { | |
| 'form_name': 'Contact Form', | |
| 'form_id': event.target.name | |
| }); | |
| } else { | |
| window.dataLayer = window.dataLayer || []; | |
| window.dataLayer.push({ |
OlderNewer