Tagged: functions.php, header, home page, url
-
AuthorPosts
-
September 20, 2014 at 12:42 am #322173
Hi,
I want the link on the header logo to point to a different page: http://www.domain.com/home instead of http://www.domain.com
Now I found this thread: https://kriesi.at/support/topic/header-logo-url-change/ which pointed me in the right direction, but I want to do it in the enfold-child functions.php file. I don’t know php though and therefor could not figure out what the code should be.
Could you please help me out?
Thanks,
StephenThis is what I created in the functions.php file. It is not working but it shows what I was attempting to do:
/*Change the header link to point to the home page instead of the default domain*/
add_filter(‘avf_logo_link’, ‘avia_logo’);
function avia_logo() {
$link = apply_filters(‘avf_logo_link’, home_url(‘/home’));
return $link;
}September 20, 2014 at 8:26 am #322218Hey!
Try using this code instead:
add_filter(‘avf_logo_link’, 'change_logo_url’); function change_logo_url() { $link = "http://kriesi.at"; return $link; }
Best regards,
JosueSeptember 20, 2014 at 12:58 pm #322320Excellent, it works! This saves me a lot of research time.
Thank you very much.
This is the code I used in the end:add_filter(‘avf_logo_link’, ‘change_logo_url’);
function change_logo_url() {
$link = home_url(‘/home’);
return $link;September 20, 2014 at 1:00 pm #322322You are welcome, glad to help :)
Regards,
JosueOctober 20, 2014 at 6:04 pm #338511Hi,
I just discovered that in the bread crumbs section beneath the header, the home page is still pointing to http://www.abundantforever.com instead of http://www.abundantforever.com/home.
For example this post: http://www.abundantforever.com/posts/master-your-life-by-mastering-your-thoughts/ shows the bread crumbs “You are here:Home / Blog / Awareness / Master your life by mastering your thoughts (video)”, but the home link should go to the page “Home”.
What do I need to do to fix that?
Thanks,Stephen
October 20, 2014 at 7:30 pm #338563Hi Stephen,
Open /enfold/framework/php/class-breadcrumb.php and look for line 209:
$trail[] = '<a href="' . home_url() . '" title="' . esc_attr( get_bloginfo( 'name' ) ) . '" rel="home" class="trail-begin">' . $show_home . '</a>';
Replace it by this:
$trail[] = '<a href="' . home_url() . '/home" title="' . esc_attr( get_bloginfo( 'name' ) ) . '" rel="home" class="trail-begin">' . $show_home . '</a>';
Regards,
JosueOctober 20, 2014 at 8:49 pm #338629Thank you Josue.
Instead of updating the file class-breadcrumb.php, can’t I just add a small piece of code to my functions.php file in my enfold child theme? I prefer to use the child theme instead of changing theme files.And just out of curiosity, if I set the home page to page “Home”, why is the breadcrumb not picking up that page? Is this a bug or is there a logical explanation for it?
Thanks,Stephen
October 26, 2014 at 3:23 pm #341134Hi Josue or somebody else. Could you please replay on my last question:
Instead of updating the file class-breadcrumb.php, can’t I just add a small piece of code to my functions.php file in my enfold child theme? I prefer to use the child theme instead of changing theme files.And just out of curiosity, if I set the home page to page “Home”, why is the breadcrumb not picking up that page? Is this a bug or is there a logical explanation for it?
Thanks,Stephen
October 27, 2014 at 9:59 pm #341809Hi Stephen!
What you set there is the “homepage page” to show, but the “homepage url” will always be ‘/’ (that’s why we have to re-declare the home URL in the logo, breadcrumb, etc) unless you change that in Settings > General.
Regards,
Josue -
AuthorPosts
- You must be logged in to reply to this topic.