WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] home link not working (9 posts)

  1. bloggingcss
    Member
    Posted 5 years ago #

    Hi,

    I have recently published my first blog: http://www.bloggingcss.com

    I have a problem on the single post pages and the archive pages, the problem being that if I click on the blog logo, which is linked to the home page, I don't get the home page. In one word, the link doesn't work.

    The only "unconventional" thing that I've done about that link is building a function to wrap it in h1 tags on the home page and h4 tags in every other page (for SEO reasons). I don't think this has something to do with it, as the generated html is correct, but anyway here is the function:

    <?php
            if (is_home()) {
    		$titleTagOn = "<h1>";
    		$titleTagOff = "</h1>";
    	} else {
    		$titleTagOn = "<h4>";
    		$titleTagOff = "</h4>";
    	}
    ?>

    And here is how I call it:

    <div id="logo"><?php echo $titleTagOn; ?><a href="index.php">Blogging CSS</a><?php echo $titleTagOff; ?></div>

    Can anybody help?

    TIA

  2. 11worth
    Member
    Posted 5 years ago #

    Okay, I don't see how making <div id="logo"> an <h1> on the Home page and <h4> on the single and archive pages improves SEO. It makes more sense to have <div id="logo"> an <h1> for every page (posts included) to maintain semantic flow on all pages and posts.

    That being said, it looks like the PHP function breaks the link. When you hover over the blog logo on a single or archive page, you a garbled path back to index.php, rather than a direct path to index.php.

    I would do is this (if you absolutely have to do the <h4> thing):

    • First of all, delete the PHP function.
    • Create a separate file called header2.php. This is a duplicate of header.php, except in that file make <div id="logo"> an <h4> as you wish.
    • Then in archive.php (or archives.php, I can't remember which...maybe both) and single.php use the <?php include (TEMPLATEPATH . '/header2.php'); ?> include tag instead of the <?php get_header(); ?> include tag that you have in header.php.

    That should work, and would give you an unbroken path back to index.php.

  3. bloggingcss
    Member
    Posted 5 years ago #

    Hi,

    thanks for the quick answer ;). I've read somewhere that it's good SEO practice to make the logo title an h1 in the home page but not in the single post pages, 'cause the post title shoud be more important than the blog title in these.

    Anyway I think your solution will sure work. Thanks for that!

    grazz

  4. bloggingcss
    Member
    Posted 5 years ago #

    Oops, just tried that, not working. Could this have something to do with the version (I'm using WordPress 2.7)?

    Also, a notice: the tag function works locally.

    Thanks,
    grazz

  5. 11worth
    Member
    Posted 5 years ago #

    grazz,

    This does work, hopefully you'll have some luck. I tried it on two sites, one WP v. 2.6.2, and one 2.7.1, and there was no problem with either one. It's possible you have some added code here or there that's causing interference.

    One site, Cascade Kodiak Band is still left modified as a 'demo' so you can check it out. It's a 2.6.2 version based on the Kubrick theme, and is in need of some updating. But for now, if you click on the Home page, look at the subtitle, "Leavenworth, Washington" (this is from header.php). When you click on a single page or an archive page, the subtitle says, "Leavenworth, Washington- Go Kodiaks!"(from header2.php).

    I added the tag <?php include (TEMPLATEPATH . '/header2.php'); ?> to single.php and archive.php.

    Note: I notice from another thread that you're using Kubrick. The Kubrick functions.php has a lot of additional code (kubrick_head, etc.) specific to the Kubrick theme header, that I removed as part of my Kubrick mod. This may be causing some problems for you.

    You may try disabling any widgets in your header, if you have any, to see if that makes a difference.

    Hope this helps...

  6. bloggingcss
    Member
    Posted 5 years ago #

    Hi 11worth,

    thanks for your advices, although I found out that the problem is in no way related to the tag function, because I've totally removed it and wrapped the link in h1 tags on every page and it still doesn't work.

    Yes, I'm using two-column Kubrick and no, I don't use any widgets in my header.

    Would you have any other idea why this is not working?

    Thank you anyway!

  7. 11worth
    Member
    Posted 5 years ago #

    grazz,

    This may be simpler than we thought! Assuming your just using header.php, have you tried using the absolute path inside the <h> tags?:

    instead of the relative path:

    So the output in your source code would look like this:

    <div id="logo"><h1>http://www.bloggingcss.com/index.php" title="Blogging CSS è una galleria che raccoglie i migliori siti realizzati con i CSS pescati in giro per la rete!">Blogging CSS</h1></div>

    That may allow your tag function to work the way you want it to since it should generate the absolute path.

    Or, if you prefer the relative path, try instead of . This should specify your blog root directory.

    Hopefully this does it...

  8. 11worth
    Member
    Posted 5 years ago #

    grazz,

    I'm not used to this forum editor and it made a mess of my preceding post. To clarify:

    Try using this absolute path:
    http://www.bloggingcss.com/index.php

    Or possibly this relative path:
    /index.php/

    Instead of this relative path that you're currently using:
    index.php

    This may work for the tag function, but in any event should work across all pages and posts since they share the same header.php.

    Sorry about the confusing preceding post...

  9. bloggingcss
    Member
    Posted 5 years ago #

    Hi 11woth,

    this was simpler than we thought! Using the absolute path worked like a charm! Thanks for the hint ;)

Topic Closed

This topic has been closed to new replies.

About this Topic