![Check out Enfold](https://kriesi.at/wp-content/themes/kriesi/images/banner-enfold.jpg)
Tagged: acf, phone, Phone-Info
-
AuthorPosts
-
November 13, 2015 at 8:10 am #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!
November 13, 2015 at 5:41 pm #535568Hey 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,
YigitNovember 14, 2015 at 1:08 am #535780OK
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.
ACFget_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 functiondo_shortcode($phone)
changing the message within #header_metaNice 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, 10 months ago by
HuxburyQuinn.
November 14, 2015 at 2:44 am #535792it 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 ACFNovember 18, 2015 at 2:19 pm #538108Hi!
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,
AndyNovember 30, 2015 at 4:59 am #544276Ok 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_2When 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.
November 30, 2015 at 12:13 pm #544404 -
This reply was modified 8 years, 10 months ago by
-
AuthorPosts
- The topic ‘ENFOLD – Header Phone Number/Extra Info – Phone Varies’ is closed to new replies.