[resolved] Link back to blog, or "home" page (9 posts)

  1. Mortgage_Master
    Posted 6 years ago #

    How do I create a link to go to the default home page, which is the most current blogs? This is for users that browse the site, and want to see a link on top, to get back to the blogs.

    I have created "dummy" pages to try to get this to work, but to no avail. I am using a WP template, from their site.

    Thanks in advance

  2. esmi
    Forum Moderator
    Posted 6 years ago #

    Try <a href="<?php bloginfo('url');?>">Home</a>

  3. Mortgage_Master
    Posted 6 years ago #

    Hi Esmi.

    Thank you, but where should this go? I have a programming background, some of it in Perl and VB Script, so I know my way around code although php is new to me.

    I have done finds on pages in the themes editor, but am unable to find any of the page names and am unsure as to where to put this.


  4. syncbox
    Posted 6 years ago #

    I just use href="/"

  5. syncbox
    Posted 6 years ago #

    Are you using WordPress Pages as in when you create and edit, it's in the Page section? There is one file - page.php that pulls in the content from the database.

    If you are doing posts in categories, likely the file is index.php or if showing a specific category, you could create a custom category-N.php file (where N=the category ID) and that will be used.

    There are no "static pages" created and stored in the theme folder for an application like WordPress. But any theme should have the index.php file, header.php file, footer.php file, sidebar.php, etc

    Read about templates and template files heirarchy:

    hope that helps

  6. Mortgage_Master
    Posted 6 years ago #

    Wow! This is getting very deep, and I apologize if I seem slow. I was in the page.php file, and was hoping to see something that looks like html code that I could edit. That I know how to do, but there was nothing in there like that. There are other pages on the site, and I was unable to see links for those either.

    If I do a View Souce on the page in the browser, I can see the link, and know how to fix it, but am unable to take that one step back up into the code.

    Is what I am asking for pretty common? I would think that many others have asked for this.


  7. syncbox
    Posted 6 years ago #

    The link is generated when the server parses the php that says "create a list of pages" or of categories or whatever.

    If you want to manually create a link to your home page - which is typically set in the admin's settings under "Reading" and you select a WordPress "Page" (static post versus a post in a category) the file that is used IS page.php

    The sidebar, when it lists all your pages uses a function named wp_list_pages() which takes additional information, depending upon what you want to display, like whether or not there's a title for the list or how it's ordered or what to include or exclude, etc. See the documentation for wp_list_pages() by using the search tool in the documentation section.

    In the default theme for WordPress installs, that list is in the sidebar.php file... but you won't see a "home.php" file listed, just the function that makes a call to the database to find out what to list, based on the page-slug.

    When you create a new Page in WordPress in the admin, a page slug is created. This is the "link" name of the file, typically generated on a cleaned-up version of whatever title you gave the page. Note, you CAN edit the slug. If you are using the latest versions of WordPress, you need to click on the Screen Options tab at the top right of the Write/Edit page and check the page slug option to see it. It's NOT on by default, go figure.

    It's hard not to get technical when trying to explain how WP works... it's really a GREAT idea to read the basic documentation for WordPress, especially Stepping into Templates and the specific pages about wp_list_categories() and wp_list_pages() and about the WordPress Loop. It's key to understanding how to get what you want.


  8. syncbox
    Posted 6 years ago #

    That all said, if you want to manually add a link to the homepage over by the list of pages, you can manually add one probably to your sidebar.php file

    and to get the correct page to display, you set that in Settings>Reading and then to link to it, you use what was said above, either href=/" or href="<?php bloginfo('url'); ?>"

  9. Mortgage_Master
    Posted 6 years ago #

    Thanks for your help. I wound up resolving this though in a different way than I had expected.

    I installed a plugin called Page Link To, which is a WP plugin, if you are unfamiliar with it, and it helps pages link to external pages.

    Now it points to the main blog page (recent posts) and all works well.

    As far as learning code, I would love to be able to take the time to sit down and become as proficient as I would like, but having learned other languages, I know how much time it takes to become proficient.

    The blog is now a sales tool for me, and my goal is to put as little time into getting what I need out of it as I have to put it, so I can work on getting people into it.

    Thanks again

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.