WordPress.org

Ready to get started?Download WordPress

Forums

[closed] Homepage different code to internal pages (12 posts)

  1. Christopher Roberts
    Member
    Posted 1 year ago #

    Hi everyone, I have been trying to work out how to get the homepage to display the blog title as a h1 tag, whilst the internal pages just display it as standard text.

    I know this code

    <?php
    if ( is_home() ) {
    echo "<h1><a href='/' title='My homepage'>My sites name</a></h1>";
    } else {
    echo "<a href='/' title='My homepage'>My sites name</a>";
    }
    ?>

    displays the same on both pages except non-homepage pages show the text as a h1 tag, but I want the blog to fetch the sites name for me, so if I change it through WordPress and the database, the title changes without me having to edit the code.

    Any thoughts?

    Thanks :-)
    Christopher

  2. Andrew
    Forum Moderator
    Posted 1 year ago #

    Use the bloginfo function;
    http://codex.wordpress.org/Function_Reference/bloginfo#Show_Blog_Title

    <?php
    $blogname = bloginfo('name');
    if ( is_home() ) {
     echo "<h1><a href='/' title='My homepage'> $blogname </a></h1>";
    } else {
     echo "<a href='/' title='My homepage'> $blogname </a>";
    }
    ?>
  3. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    want the blog to fetch the sites name for me

    replace

    My sites name

    with

    <?php bloginfo('name'); ?>

    http://codex.wordpress.org/Function_Reference/bloginfo

  4. Christopher Roberts
    Member
    Posted 1 year ago #

    Thanks, this one worked, but the text wasn't hyperlinked...

    <?php
    $blogname = bloginfo('name');
    if ( is_home() ) {
     echo "<h1><a href='/' title='My homepage'> $blogname </a></h1>";
    } else {
     echo "<a href='/' title='My homepage'> $blogname </a>";
    }
    ?>
  5. Andrew
    Forum Moderator
    Posted 1 year ago #

    Can you link the webpage where the text isn't hyperlinked?

  6. Christopher Roberts
    Member
    Posted 1 year ago #

    I am testing the code on my test site: http://www.technologybloggers.co.uk/test/

  7. Christopher Roberts
    Member
    Posted 1 year ago #

    If you visit the main site: http://www.technologybloggers.org/ all I want to do is move the logo http://www.technologybloggers.org/images/Technology-Bloggers-Logo.png so that it is in the centre, rather than at the left, but I am really struggling to sift my way through the css and PHP, so have started to try and redesign it myself, but am facing big issues!

    I am using twenty-ten - slightly modified/personalised.

  8. Andrew
    Forum Moderator
    Posted 1 year ago #

    There's nothing set in the title of the test webpage;

    <h1><a href="/" title="My homepage">  </a></h1>

    Are you sure the blog's title is set through the dashboard?

  9. Andrew
    Forum Moderator
    Posted 1 year ago #

    all I want to do is move the logo

    Sorry, I must have misunderstood the issue.

  10. Christopher Roberts
    Member
    Posted 1 year ago #

    Okay...

    I am a member of the admin team for a community blog called Technology Bloggers.

    Currently the logo is on the left of the header - as you can see on the blog.

    I want to move the logo to the centre like in this image I have created - http://www.technologybloggers.org/images/idea-technology-bloggers-header.jpg

    To try and do this I have been attempting to reconstruct and rebuild the CSS and PHP that makes up the header and start from scratch to make my own. I am doing this on a test site so that the actual site experiences no faults/design issues whilst I tweak things.

    All I want is to have that image in the centre, but it is proving a challenge!

    Any ideas?

  11. Christopher Roberts
    Member
    Posted 1 year ago #

    I am happy to keep the current code, but have no idea how to move the image!

    The theme is twenty-ten with a few custom modifications.

  12. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    It looks like you created a new duplicate thread for this?

    http://wordpress.org/support/topic/move-an-image-in-the-header?replies=4

    Duplicate threads make it much harder for people here to help you - please don't. As the new one now seems more current and relevant, closing this thread.

Topic Closed

This topic has been closed to new replies.

About this Topic