WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Link to a Page (16 posts)

  1. unicom68
    Member
    Posted 6 years ago #

    <!-- begin footer -->

    <?php get_sidebar(); ?>

    <p id="credits">

    © Copyright <?php echo date("Y")." "; bloginfo('name'); ?>. All rights reserved.

    Powered by WordPress . <?php wp_loginout(); ?>

    </p>

    </div>

    <?php do_action('wp_footer'); ?>
    </body>
    </html>

    ----------
    <!-- begin testpage -->

    <?php get_header(); ?>

    <div id="bloque">
    <div id="noticias">

    <h2 class="center">Test</h2>

    <p>

    This is a test page.
    </p>

    </div>

    <?php get_footer(); ?>

    ----------

    Above are two scripts that I have composed. I would like to link to 'test.php' when one click at the footer - test. However, no matter how hard I tried, I can never link successfully to the test.php. I have even modified the test.php to html format. But it simply don't work. Can anyone advice?

    Many Thanks!

  2. moshu
    Member
    Posted 6 years ago #

    You can never link directly to any template files.
    What is it what you want to do? Don't tell me HOW (since obviously, that didn't work), tell me WHAT do you want to achieve.

  3. unicom68
    Member
    Posted 6 years ago #

    I want to display the disclosure terms. I understand that I can easily achieve that by creating a new page. However, as disclosure is not meant to be main topic, i thought it is neater to have that separate link where when one click - 'disclosure' in the footer, the disclosure will be displayed out. Please advice how that can be done. Thanks.

  4. moshu
    Member
    Posted 6 years ago #

    You still should go by creating a new Page. You will exclude it from showing up among your other Pages - for that you need to read the documentation!
    Template_Tags/wp_list_pages

    and then make a link from your footer.php to that hidden Page.
    Done.

  5. unicom68
    Member
    Posted 6 years ago #

    Ok, according to the documentation, the page can be excluded by the following script:

      <?php
      wp_list_pages('title_li='); ?>

    ------

    I have two questions:
    1 Where should I add this? In the Stylesheet? Main Index Template? Page Template?
    2 How do I link to that page from the footer?

    Thanks.

  6. unicom68
    Member
    Posted 6 years ago #

    Ok, I noted that I can use the following code to exclude a page:

    <?php wp_list_pages('exclude=arguments' ); ?>

    Based on the tutorial, I would like to know whenever I write a page, it will create a page no automatically? So if blog = page 1, about = page 2 and so on. In this case, if I want to exclude a page, say page 3, is it write to just

    <?php wp_list_pages('exclude=3' ); ?>

    I tried that, but it doesn't work.

    Likewise, for the linking to the page, I understand the code is

    <?php wp_link_pages('arguments'); ?>

    but how could I first display the word say 'disclosure' so that when one click on the word 'disclosure' it will point to the disclosure page?

  7. Sammy Russo
    Member
    Posted 6 years ago #

    try using <?php wp_list_pages('exclude=3'); ?>

    replace link with list... as for the display name in the Post Title field use 'Disclosures' or whatever you want the display name to be and that should take care of it

    I use the include and exclude code all the time and never had a problem with it.

    the following string of code is directly from my website you may want to try and use all of the arguments and add your exclude to it..

    <?php wp_list_pages('sort_column=menu_order&title_li=&include=2,9'); ?>

    replace inlcude=2,9 with exclude=3

  8. unicom68
    Member
    Posted 6 years ago #

    Thanks. But it don't work.

  9. unicom68
    Member
    Posted 6 years ago #

    Hi SRmarketing, I managed to sort out the reason. Your command is right. The reason it did not work is because, I was not aware that the number is actually dispalyed in post and page. I thought, by default the blog page is 0, the About page is 1 and so on...After I make the changes accordingly, I managed to exclude pages that I don't wish to display.

    However, I am still not able to link to the footer wording 'disclosure' to the disclosure page. Any recoomendations?

    Many thanks!

  10. unicom68
    Member
    Posted 6 years ago #

    Hi moshu, how could I make the link in the footer.php to a page? This is the command line that I included in the footer.php:

    ">Disclaimer.

    assuming 39 is the page that I am linking to. It is not working!

    Your advice please. Many thanks!

  11. unicom68
    Member
    Posted 6 years ago #

    Sorry for the typo error, the command line should read as follows:

    |Disclaimer|

    Thanks and Regards.

  12. moshu
    Member
    Posted 6 years ago #

  13. unicom68
    Member
    Posted 6 years ago #

    Hi moshu, pardon me, I am confused. When I create a new page from WordPress and say 'Disclosure' how could I link at the footer.php to that 'disclosure' page? I have searched in the director but I could not find the page that is named 'disclosure'. Where is 'discloure' located? Also, I thought it is not possible to link page within the blog?

    Thanks!

  14. unicom68
    Member
    Posted 6 years ago #

    Maybe, I should put it another way, I had used wordpress to create 'disclosure' page. But where can I find that page so as to establish the link using the html command as recommended by you? I have search throughtout the directory but found nothing like 'disclosure.html' or something close to!

    Thanks!

  15. moshu
    Member
    Posted 6 years ago #

    Don't make it more difficult than it is :)
    If you already created the Page - go admin > Manage > Pages. You will see a list of them. Next to your disclosure Page click View. It will take you tot THAT Page. Copy the address that you see in your browser's address bar.
    Make a normal html link (anchor) with that address in your footer.php.
    Done.

  16. unicom68
    Member
    Posted 6 years ago #

    Hi moshu, yup, it's that easy! Many Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags