WP Residence Help WP Residence Help

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

Header Media Actions and Filters – part 2

275 views 0

Extending WPResidence Theme with Actions and Filters – Part 2

1. Additional Actions in header_media.php

1.1 wpestate_before_header_media_content

This action is executed before the main header media content.

Usage in child theme’s functions.php:

function my_custom_before_header_media_content() {
echo '<div class="pre-header-content">Important announcement here</div>';
}
add_action('wpestate_before_header_media_content', 'my_custom_before_header_media_content');

1.2 wpestate_after_header_media_content

This action is executed after the main header media content.

Usage example:

function my_custom_after_header_media_content() {
echo '<div class="post-header-content">Check out our latest listings</div>';
}
add_action('wpestate_after_header_media_content', 'my_custom_after_header_media_content');

1.3 wpestate_before_mobile_search

This action is executed before displaying mobile search.

Usage example:

function my_custom_before_mobile_search() {
if (wp_is_mobile()) {
echo '<div class="mobile-search-tip">Tap to start your search</div>';
}
}
add_action('wpestate_before_mobile_search', 'my_custom_before_mobile_search');

1.4 wpestate_after_mobile_search

This action is executed after displaying mobile search.

Usage example:

function my_custom_after_mobile_search() {
if (wp_is_mobile()) {
echo '<div class="mobile-search-results">Your results will appear here</div>';
}
}
add_action('wpestate_after_mobile_search', 'my_custom_after_mobile_search');

2. Additional Filters in header-media-functions.php

2.1 wpestate_404_archive_header_type

This filter customizes header type for 404 and archive pages with Google Map taxonomy.

Usage example:

function my_custom_404_archive_header_type($header_type) {
if (is_404()) {
return 2; // Use image header for 404 pages
}
return $header_type;
}
add_filter('wpestate_404_archive_header_type', 'my_custom_404_archive_header_type');

2.2 wpestate_property_list_header_type

This filter customizes header type for property list pages.

Usage example:

function my_custom_property_list_header_type($header_type) {
if (is_post_type_archive('estate_property')) {
return 3; // Use theme slider for property archive
}
return $header_type;
}
add_filter('wpestate_property_list_header_type', 'my_custom_property_list_header_type');

3. Extending Theme Slider Functionality

3.1 wpestate_slider_cycle

This filter allows customization of the slider cycle time.

Usage example:

function my_custom_slider_cycle($cycle_time) {
return 7000; // Set slider cycle time to 7 seconds
}
add_filter('wpestate_slider_cycle', 'my_custom_slider_cycle');

3.2 wpestate_theme_slider_content

While not a direct filter, you can create this filter to modify the slider content.

First, in the theme slider function, add this filter:

$slider_content = apply_filters('wpestate_theme_slider_content', $default_content, $post_id);

Then in your child theme:

function my_custom_slider_content($content, $post_id) {
$custom_field = get_post_meta($post_id, 'custom_slider_text', true);
if (!empty($custom_field)) {
$content .= '<div class="custom-slider-text">' . esc_html($custom_field) . '</div>';
}
return $content;
}
add_filter('wpestate_theme_slider_content', 'my_custom_slider_content', 10, 2);

4. Customizing Header Image Display

4.1 wpestate_header_image_height

This filter allows customization of the header image height.

Usage example:

function my_custom_header_image_height($height) {
if (is_front_page()) {
return 800; // Set front page header height to 800px
}
return $height;
}
add_filter('wpestate_header_image_height', 'my_custom_header_image_height');

4.2 wpestate_header_overlay_opacity

This filter allows customization of the header overlay opacity.

Usage example:

function my_custom_header_overlay_opacity($opacity) {
if (is_single() && get_post_type() == 'estate_property') {
return 0.7; // Increase overlay opacity for single property pages
}
return $opacity;
}
add_filter('wpestate_header_overlay_opacity', 'my_custom_header_overlay_opacity');

These additional examples provide more ways to extend and customize the WPResidence theme using actions and filters in a child theme. By leveraging these hooks, you can further modify the theme’s functionality and appearance to meet specific requirements.

Technical how to | Custom Code Required

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