Tagged: , ,

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #535266

    Hi

    Just recently noticed that the HEADER SOCKET > Header Phone Number/Extra Info

    When I’m on a page that has a different phone number the message I’ve added in the admin is replaced with the phone number from that page.

    I have not noticed this before

    is it a new theme feature ?

    I could not find the php function that is doing this – can you point me in the right direction

    Thanks!

    #535568

    Hey HuxburyQuinn!

    No, it should not do it. Please try flushing cache and refreshing your page a few times. Have you applied any changes to phone info field previously?

    Regards,
    Yigit

    #535780

    OK

    enfold/includes/helper-main-menu.php
    line 68 – 71

    						//phone/info text	
    						$phone			= $headerS['header_phone_active'] != "" ? $headerS['phone'] : "";
    						$phone_class 	= !empty($nav) ? "with_nav" : "";
    						if($phone) 		{ echo "<div class='phone-info {$phone_class}'><span>".do_shortcode($phone)."</span></div>"; }
    

    The string $phone is the issue.

    Our site uses Advanced Custom Fields extensively as part of the admin for Custom Post Types.
    ACF get_field ('phone'); of each location.

    On each location page a function calls get_field ('phone'); to return the phone number for that location. That phone number is then also being used by the header function do_shortcode($phone) changing the message within #header_meta

    Nice to know finally what’s going on.
    I might write a function at some point allowing the customisation of the message of each pages phone number – which could be quite interesting.

    Since phone is a common string name – it would be good if the next updated of ENFOLDS included renaming $phone within your function, to something that was more ENFOLDS specific $avia_phone removing my need to hack the parent file and removing any future conflicts to other programers…

    if($avia_phone) {
    echo "<div class='phone-info 
    {$avia_phone_class}'><span>".do_shortcode($avia_phone)."</span></div>";
     }

    Our programmer is working on a filter to get around manually editing the parent theme and I will post back a solution once it’s completed.

    • This reply was modified 8 years, 6 months ago by HuxburyQuinn.
    #535792

    it goes deeper than that

    enfold/includes/admin/register-admin-options.php

    line 1764

    $avia_elements[] = array(
    						"name" 	=> __("Phone Number or small info text", 'avia_framework'),
    						"desc" 	=> __("Add the text that should be displayed in your header here", 'avia_framework'),
    						"id" 	=> "phone",
    						"type" 	=> "text",
    						"std"	=> "",
    						"class" => "av_2columns av_col_2",
    						"required" => array('header_phone_active','{contains}phone_active'),
    						"slug"	=> "header");
    

    the id = phone

    is a called be several functions

    enfold/includes/admin/helper-compat-update.php

    	if(!empty($theme_options['phone'])) $theme_options['header_phone_active'] = "phone_active_right extra_header_active";
    

    enfold/includes/admin/helper-main-menu.php

    
    $phone			= $headerS['header_phone_active'] != "" ? $headerS['phone'] : "";
    

    it’s not the string $phone
    it’s the #ID of the field [‘phone’] thats the same ID as the ACF

    #538108

    Hi!

    feel free to make a feature request for Kriesi here: kriesi.at/support/enfold-feature-requests/ about “phone” as common string.

    I think you could use some plugins with such functions you need, like for example: https://de.wordpress.org/plugins/custom-header-extended/

    Regards,
    Andy

    #544276

    Ok for anyone else who comes across this problem in the future.

    Where have a website that is heavily built on Advance Custom Fields (ACF)
    There are 2 custom post types
    custom_post_type_1
    custom_post_type_2

    When adding a new custom_post_type there is an ACF “phone” to capture and display the phone number.
    Between the 2 custom post types above, this affect 26 posts.
    No big deal – but it may be if you have hundreds’ of posts.

    So we discovered the Kriesi Enfold Theme header meta data uses
    "id" => "phone",

    So now when we navigate to: custom_post_type_1 or custom_post_type_2 – instead of showing the
    ENFOLD CHILD > HEADER > EXTRA ELEMENTS > Phone Number or small info text
    The text is replaced with the Advance Custom Filed (ACF) “phone” for that post.

    Nice to know if you intentionally want to make this happen. But if you don’t then do the following:

    In your theme’s function.php file add the following:

    function enfold_filter_header_options( $header ){
    
    	if( is_single() ){
    
    		$post_type = get_post_type();
    
    		if( in_array( $post_type, array( 'custom_post_type_1', 'custom_post_type_2' ) ) ){
    
    			$settings = avia_get_option();
    
    			if( isset( $settings['phone'] ) ){
    				$header['phone'] = $settings['phone'];
    			}
    
    		}
    
    	}
    
    	return $header;
    
    }
    add_filter( 'avf_header_setting_filter', 'enfold_filter_header_options', 10, 1 );

    I hope this helps someone else with a similar problem.

    #544404

    Hey!

    Thank you for sharing your solution :)

    Cheers!
    Yigit

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘ENFOLD – Header Phone Number/Extra Info – Phone Varies’ is closed to new replies.