• Resolved Andrew Tegenkamp

    (@andrewteg)


    We’re customizing Twenty Seventeen for a landing page theme and would like the site title link on the homepage to do something else as right now it just reloads the homepage. This is default behavior as at https://2017.wordpress.net if you click “NEEDLE & HOOK” it just reloads the page. We want it to go to the Welcome, like when you click the down arrow in the bottom right of the homepage.

    I can change this (in a child theme) as I found in template-parts\header\header.php the code:
    <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
    can be:
    <h1 class="site-title"><a href="#content"><?php bloginfo( 'name' ); ?></a></h1>
    to get what I want, but I’m wondering if there is a better way I’m missing. It seems odd to me to have the main link just reload the homepage so I feel like that should be an option I’m just not finding.

    Thanks,
    Andrew

Viewing 6 replies - 1 through 6 (of 6 total)
  • There’s a few ways you can do this, with either a function, an HTACCESS redirect, or manually changing the link.

    However, just to confirm, are you wanting the link to scroll down to that part in a one-page website concept, or a completely different page?

    Thread Starter Andrew Tegenkamp

    (@andrewteg)

    We’re going for the “scroll down to that part in a one-page website concept” option. I can do a child theme but just wasn’t sure if that was the best option.

    I’ve never tried that, but also know the theme is not setup for a one-page concept, but apparently you can do that. I did a quick search and found this, although not sure if this will give you 100% of what you want:

    2017 One-Page Scrolling

    For a regular type website instead, you can do it with functions, HTACCESS redirect, or manually code the full URL to a page in your site-branding.php file by replacing the php code like you did with adding #content but using a full url there instead. Ultimately, the #content requires an anchor somewhere in the same page to work.

    Thread Starter Andrew Tegenkamp

    (@andrewteg)

    Thanks for all the tips! We went ahead with the child theme and changed the line I mentioned in the original post, and then also added this filter to functions.php to make the custom logo go to #content. It looks like 2017 already has #content as a page anchor by default for the down arrow in the menu bar on the homepage so it works well for our needs ??

    
    //make custom logo go to #content on home page
    add_filter('get_custom_logo', 'at_custom_logo');
    function at_custom_logo($html, $blog_id) {
    	if ( is_front_page() ) {
    		$html = implode('#content', explode(home_url('/'), $html, 2)); // stolen from the comments at PHP.net/str_replace as function replace_first
    	}
    	return $html;
    }
    

    Edit: You can see it for now at https://dontgobe.northstarfamily.org … still messing around with content and images but that’s always the case I guess!

    • This reply was modified 7 years, 7 months ago by Andrew Tegenkamp. Reason: Add example URL

    Hi

    I want to achieve the same as Andrew desired and eventually got, but being a newbie, I’m unable to start my journey. It also appears that coding has changed in “template-parts\header\header.php” as I can’t find out the code that Andrew pointed out for a change.

    Any help would be highly valuable.

    Thanx
    Max

    Thread Starter Andrew Tegenkamp

    (@andrewteg)

    Hi @maxal,

    You’re right. It’s now in template-parts\header\site-branding.php where we need to make a change. I uploaded a child theme that we are currently using ok. You can download it at https://wp.andrewteg.com/files/twentyseventeen-relinked.zip

    Hope that helps!
    Andrew

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Change Site Title Link on Hompeage?’ is closed to new replies.