[resolved] How to call a page (5 posts)

  1. nette
    Posted 8 years ago #

    I am having trouble calling a page into my template. I created a page with filename comments2.php and uploaded it to my wordpress themes directory. Now I want to call that page into my template how do I do that..I have searched the forums but was unable to come up with the function I have tried
    <?php get_comment2() ?> and
    <?php comments2(); ?> but it's not working i get an error:

    Fatal error: Call to undefined function: get_comments2() in /home/electrif/public_html/bangel/wp-content/themes/fansites-theme-1/mtb4moments.php on line 28

    MTB4moments is the page I am trying to include the function on...any help would be appreciates

  2. wp_guy
    Posted 8 years ago #

    If you're trying to use comments2.php as a page template, then the file must start with:

    Template Name: Comments 2

    Then you can create a page and choose "Comments 2" from the Page Template dropdown menu.

    Or, if you're just trying to include that file inside another, then all you have to do is:

    <?php include('comments2.php'); ?>

  3. nette
    Posted 8 years ago #

    It's still not working here's what I am trying to do. I wanted to use a different comments form for a certain section of the site. So I copied the original comments file made a comments2 page out of it and just changed the field name like where is says name, email, website etc I have changed to my own titles.

    Now on the actual page which is another page I made I want to use that comments form so I was trying to do an include within that page so it uses that comment form but it's not working I have did the instructions you left which i what I had before but it's still not working...anymore help please

  4. wp_guy
    Posted 8 years ago #

    Turns out it's much easier than that... the comments_template(); function accepts one parameter, the file that you want to load. So this should work:

    <?php comments_template("/comments2.php"); ?>

  5. nette
    Posted 8 years ago #

    That worked thanks alot!

Topic Closed

This topic has been closed to new replies.

About this Topic