Support » Themes and Templates » How to call a page

  • Resolved nette


    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

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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'); ?>

    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

    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"); ?>

    That worked thanks alot!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to call a page’ is closed to new replies.