WP Residence Help WP Residence Help

  • WpEstate
  • How to Build Your Website
  • Video Tutorials
  • Client Support
  • API
Home / Technical how to | Custom Code Required, WpResidence 5.0 / Header Media Actions and Filters

Header Media Actions and Filters

330 views 0

Extending WPResidence Theme with Actions and Filters

1. Actions in header_media.php

1.1 wpestate_before_header_media

This action is executed before the header media section begins.

Usage in child theme’s functions.php:

function my_custom_before_header_media() {
echo '<div class="custom-header-top">Custom content before header media</div>';
}
add_action('wpestate_before_header_media', 'my_custom_before_header_media');

1.2 wpestate_before_advanced_search

This action is executed before the advanced search is displayed.

Usage example:

function my_custom_before_advanced_search() {
if (is_front_page()) {
echo '<div class="search-intro">Find your dream property</div>';
}
}
add_action('wpestate_before_advanced_search', 'my_custom_before_advanced_search');

1.3 wpestate_after_advanced_search

This action is executed after the advanced search is displayed.

Usage example:

function my_custom_after_advanced_search() {
echo '<div class="search-tips">Need help? Check our search tips</div>';
}
add_action('wpestate_after_advanced_search', 'my_custom_after_advanced_search');

2. Filters in header-media-functions.php

2.1 wpestate_header_type

This filter allows modification of the header type for any page.

Usage example to force a specific header type for a certain page:

function my_custom_header_type($header_type, $post_id) {
if ($post_id == 123) { // Replace with your specific page ID
return 2; // Force image header type
}
return $header_type;
}
add_filter('wpestate_header_type', 'my_custom_header_type', 10, 2);

2.2 wpestate_global_header_type

This filter allows customization of the global header type for non-archive pages.

Usage example to change the global header type:

function my_custom_global_header_type($global_header_type) {
if (is_front_page()) {
return 3; // Use Revolution Slider for front page
}
return $global_header_type;
}
add_filter('wpestate_global_header_type', 'my_custom_global_header_type');

2.3 wpestate_header_media_class

This filter allows modification of the header media CSS class.

Usage example to add a custom class:

function my_custom_header_media_class($class) {
return $class . ' my-custom-header-class';
}
add_filter('wpestate_header_media_class', 'my_custom_header_media_class');

3. Extending Theme Slider Functionality

3.1 wpestate_theme_slider_contact

While not a direct action or filter, this function can be overridden in a child theme to customize the contact section in the theme slider.

Example of overriding in child theme’s functions.php:

function wpestate_theme_slider_contact($propid) {
// Custom implementation
$output = '<div class="custom-slider-contact">';
$output .= '<h3>Contact Agent</h3>';
$output .= '<a href="' . get_permalink($propid) . '#contact">Inquire Now</a>';
$output .= '</div>';
return $output;
}

4. Customizing Header Image Display

4.1 Overriding wpestate_header_image function

While not a direct filter, you can completely override the header image display by redefining the function in your child theme.

Example in child theme’s functions.php:

function wpestate_header_image($image) {
global $post;
if (is_single() && get_post_type() == 'estate_property') {
// Custom header for single property pages
$property_id = get_the_ID();
$header_image = get_post_meta($property_id, 'property_custom_header', true);
if (!empty($header_image)) {
echo '<div class="property-custom-header" style="background-image:url(' . esc_url($header_image) . ')"></div>';
return;
}
}
// Fall back to parent theme's implementation for other cases
include_once(get_template_directory() . '/header-media-functions.php');
wpestate_header_image($image);
}

5. Customizing Theme Slider

5.1 wpestate_theme_slider_height

This filter allows customization of the theme slider height.

Usage example:

function my_custom_slider_height($height) {
return 600; // Set slider height to 600px
}
add_filter('wpestate_theme_slider_height', 'my_custom_slider_height');

These examples demonstrate various ways to extend and customize the WPResidence theme using actions, filters, and function overrides in a child theme. By leveraging these hooks, you can significantly alter the theme’s functionality and appearance without modifying the parent theme files directly.

Technical how to | Custom Code RequiredWpResidence 5.0

Related Articles

  • Technical – How to Change the Minimum Image Dimensions for Property Uploads in WPResidence
  • Introduction to WPResidence Header Customization
  • Understanding WPResidence Header Types: An Overview
  • Customizing the WPResidence Logo Display

WP Residence Documentation

  • 1. General
    • How to Get Support
    • Get your buyer license code.
    • Use SSL / https
    • Server / Theme Requirements
  • 2. Installation
  • 3. Installation FAQ
  • 4. Advanced Search
    • Advanced Search Display Settings
    • Advanced Search Form
    • Geolocation Search for Half Map
    • Save Search Theme Options
    • Advanced Search Colors
  • 5. Agent, Agency & Developers
  • 6. Property Page
  • 7. Properties List
  • 8. Property Taxonomies
  • WpResidence Elementor Studio
  • 10. Blog Posts & Blog List
  • 11. Shortcodes
    • Contact Form
    • Featured Agency/Developer
    • Membership Packages
    • Testimonials
    • Google Map with Property Marker
    • Listings per Agent, Agency or Developer
    • Display Categories
    • Agent List
    • Recent Items Slider
    • Recent items
    • List Properties or Articles by ID
    • Featured Agent
    • Featured Article
    • Featured Property
    • Login & Register Form
    • Icon Content Box Shortcode
  • 12. Widgets
  • Theme Options
    • General Settings
    • User Types Settings
    • Appearance
    • Logos & Favicon
    • Header
    • Footer Style and Colors
    • Price & Currency
    • Property Custom Fields
    • Features & Amenities
    • Listing Labels
    • Theme Slider
    • Permalinks
    • Splash Page
    • Social & Contact
    • Map Settings
    • Pin Management
    • How read from file works
    • General Design Settings
    • Custom Colors Settings
    • Header Design & Colors
    • Mobile Menu Colors
    • User Dashboard Colors
    • Print PDF Design
    • Property, Agent, Blog Lists Design Settings
    • Sidebar Widget Design
    • Font management
    • How to add custom CSS
    • Custom Property Card Unit – Beta version
    • Email Management
    • Import & Export theme options
    • reCaptcha settings
    • YELP API Integration
    • iHomefinder Optima Express IDX
    • MEMBERSHIP & PAYMENT Settings
    • Property Submission Page
    • PayPal Setup
    • Stripe Setup
    • Wire Transfer Payment Method
  • Translation
  • FAQ
  • Pages
  • Header
  • Footer
  • Google or Open Street Maps
  • Payment Options
  • Plugins
    • Included Plugins
    • Third Party Plugins – IDX Compatibility
    • Third Party Plugins – Multi Languages
    • Third party Plugins – Other
  • Technical
    • Technical how to | Custom Code Required
    • Technical: Child Theme

Join Us On

Powered by WP Estate - All Rights Reserved
  • WpEstate
  • How to Build Your Website
  • Video Tutorials
  • Client Support
  • API