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 / Working with the Mobile Header in WPResidence

Working with the Mobile Header in WPResidence

618 views 0

Working with the Mobile Header in WPResidence

The mobile header in WPResidence is a crucial component for providing a seamless user experience on smaller screens. This guide will walk you through customizing and optimizing the mobile header for your WPResidence theme.

Understanding the Mobile Header Structure

The mobile header in WPResidence typically consists of three main elements:

  1. Mobile logo
  2. Mobile menu trigger (hamburger icon)
  3. User menu trigger

Customizing the Mobile Header

1. Mobile Logo

To customize the mobile logo, navigate to the WPResidence theme options panel and look for the “Logos & Favicon” section. Here, you’ll find an option to upload a specific logo for mobile devices:


$mobilelogo = esc_html(wpresidence_get_option('wp_estate_mobile_logo_image','url'));
if ($mobilelogo != '') {
print '<img src="'.esc_url($mobilelogo).'" class="img-responsive retina_ready" alt="'.esc_html__('mobile logo','wpresidence').'"/>';
} else {
print '<img class="img-responsive retina_ready" src="'. get_theme_file_uri('/img/logo_mobile.png').'" alt="'.esc_html__('mobile logo','wpresidence').'"/>';
}

To further customize the mobile logo appearance, you can add custom CSS to your child theme’s style.css file:


.mobile-logo img {
max-height: 50px;
width: auto;
}

2. Mobile Menu Trigger

The mobile menu trigger (hamburger icon) can be styled using CSS in your child theme:


.mobile-trigger {
font-size: 24px;
color: #333333;
}
.mobile-trigger:hover {
color: #0073e1;
}

3. User Menu Trigger

Customize the user menu trigger icon with CSS in your child theme:


.mobile-trigger-user {
font-size: 22px;
color: #333333;
}
.mobile-trigger-user:hover {
color: #0073e1;
}

Adjusting Mobile Header Behavior

Sticky Mobile Header

WPResidence allows you to enable a sticky mobile header. This option can be found in the theme options panel under the “Header” section. To programmatically check if the sticky mobile header is enabled, use:


$mobile_header_sticky = esc_attr(wpresidence_get_option('wp_estate_mobile_sticky_header'));
if ($mobile_header_sticky == 'yes') {
// Apply sticky header styles or behaviors
}

Customizing Mobile Header Height

To adjust the height of the mobile header, add the following CSS to your child theme’s style.css:


.mobile_header {
height: 70px; /* Adjust this value as needed */
}

Adding Custom Elements to the Mobile Header

To add custom elements to the mobile header, you can use the ‘wp_estate_mobile_header_after’ action hook in your child theme’s functions.php file:


function add_custom_element_to_mobile_header() {
echo '<div class="custom-mobile-element">Custom Content</div>';
}
add_action('wp_estate_mobile_header_after', 'add_custom_element_to_mobile_header');

Customizing Mobile Menu

The mobile menu can be styled using CSS in your child theme. Here’s an example of how to customize the appearance:


.mobilex-menu {
background-color: #f7f7f7;
}
.mobilex-menu li {
border-bottom: 1px solid #e0e0e0;
}
.mobilex-menu li a {
color: #333333;
font-size: 14px;
padding: 15px 20px;
}
.mobilex-menu li:hover > a {
background-color: #0073e1;
color: #ffffff;
}

Optimizing Mobile Header Performance

To ensure optimal performance of the mobile header:

  1. Use appropriately sized images for the mobile logo
  2. Minimize the use of complex animations or transitions
  3. Leverage browser caching for static assets

Conclusion

Customizing the mobile header in WPResidence allows you to create a user-friendly and visually appealing experience for mobile users. Remember to always make customizations through a child theme to ensure your changes persist through theme updates. With these techniques, you can tailor the mobile header to match your site’s branding and improve overall mobile usability.

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