I would like to create a simple one-page portfolio theme for my own use. Most of the content will be static. The main reason I want to make it in WordPress at all is to make use of Contact Form 7 and include blog posts from another site of mine. My questions:

  • I'll create a page template for the main content. What needs to be in the index.php file, considering that I won't actually use it (but WordPress still requires it)?
  • What is the right way to pull in blog posts from my other site?

closed as too broad by Pieter Goosen, fuxia Jul 28 '14 at 7:41

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


There is no RIGHT way to do this, instead there might be more efficient ways and or preferred ways to do this over another but even then, that does not make any of them more right than the other.

I say this just to clear to air in case you and or others take any "selected" answer as being gospel because there are many ways to skin a cat achieve an presentational layout with WordPress.

Conforming to best practice standards via the use of WordPress API functions and conditional tags is what's most important here. Everything else is a matter of opinion and taste.


Contact Form 7 can be embedded into any Post or Page you choose.


It appears you are confusing the term Page Template with the term Page.

You can think of a Page in WordPress as something like your About, Services, Contact page that you would commonly see on sites. These pages appear as separate entities beyond your homepage.

Pages can literally be anything you want them to be.

Most importantly,

Any Page you create in WordPress can be assigned as your front page, thus becoming the first thing people see when they land on your top level domain. This is known as a static page, but although the page is static, its only in terms of the page in which is shown, it does not refer to the data which appears on that page which can be as entirely dynamic and creative as you wish.

And to clarify,

You said...

The reason I'd use a page template and not index is that Contact Form 7 requires it (assuming I understand it correctly...but perhaps I don't). - Brian O'Neill

You might be confusing the term Page Templates with the term Page as a Page Template is something you can assign to any Page you create to help define its style, presentation and layout of data from other Pages.

As mentioned above Contact Form 7 can be embedded into any Post or Page you choose by using a shortcode that you can place into the content area of your post edit screen,


[contact-form-7 id="1234" title="Contact form 1"]

This example shortcode would make reference to a form you create with an ID 1234 and in turn that form will be displayed on that page.

Similarly you can embed multiple forms onto one Page, or different forms on as many Pages or Posts needed.

But there's more,

You can also embed a form from Contact Form 7 elsewhere in your theme and it need not necessarily be in a Post or Page. It could be in your index.php file. It could be in a sidebar.php or any other template file you might create to serve a particular purpose and you can achieve that by embedding the following code into your theme file like so;

<?php echo do_shortcode('[contact-form-7 id="1234" title="Contact form 1"]') ;?>

Shortcodes on their own as shown in my first snippet can't be used outside of your post/page content when in the post editor screen in your dashboard. However when you wrap your shortcode in the [do_shortcode][5] function above, you can execute any shortcode normally reserved for use in the post editor screen in any other template file in your theme.

This means you could in fact use your index.php to serve your entire site and in combination from within your index.php you can include various other template files to serve the various conditions you need.

So you might have a theme folder that looks like,

//Folder structure (regular theme files omitted for brevity)

   - template-about.php
   - template-blog.php
   - template-gallery.php
   - template-services.php

Then within your index.php you might have code resembling,


//All HTML markup omitted for brevity!

  <!-- start of header -->   


    <!-- start of about you -->

    get_template_part( 'template', 'about' );

    <!-- start of services -->

    get_template_part( 'template', 'services' );

    <!-- start of gallery -->

    get_template_part( 'template', 'gallery' );

    <!-- start of blog posts -->

    get_template_part( 'template', 'blog' );

            <!-- including your Contact Form 7 via do_shortcode -->

            echo do_shortcode('[contact-form-7 id="1234" title="Contact form 1"]');

  <!-- start of footer -->



Using the get_template_part function you can call from within another file (in this case your index.php file) that of another file which contains presentational data and logic to help create your desired result whatever that may be.

This helps with your organizational structure, keeping your main index.php file as lean as possible as well as a host of other potential benefits.

How you choose to present your blog posts from your other WordPress site depends on what you mean by pull in as it could mean either,

  • Pull full blog post from external site and insert into a post (in the database) of the new site and then query your new site using a loop to show posts.

  • Pull full blog post from external site without inserting it into your new site's database, thus requiring that your new site queries your other site each time someone visits your site.

  • Pull a partial excerpt with title and link to external site showing full post

  • Or a number of other interpretations...

RSS Feeds are one way (as suggested), XML-RPC is another and there are more ways to go about this some more complex than others but which may suit different purposes more than another.

As I said, many ways to do things in WordPress, being the great power of it, however what I've mentioned here is by far not the only way means or method by which you can abstract data from WordPress...

For instance using get_template_part may not be necessary in some cases, but instead using a WP_Query to pull in Page or Post content may be more suitable where instead you would create your pages via the WordPress dashboard and call them through a loop.

Or to add to the mix, you might use a combination of both be it independently of one another or dependent on another such as using WP_Query to call a page's content from within a template file used with a get_template_part function and so on and so on and so on...

Familiarizing yourself with Stepping Into Templates is a good place to start and learning about the enter link description here


If its one page - why not just use index.php without any other "template" files?

As far as pulling blog posts from another site, this may get you in trouble with google (duplicate content), so I'd read up on that a bit first. Anyway, it sort of depends on what platform the other site is built on. I've done this before just by parsing the rss feed with php... but there's probably a plugin out there that'll take care of it for you.

  • Thanks, Zach. The reason I'd use a page template and not index is that Contact Form 7 requires it (assuming I understand it correctly...but perhaps I don't). As for the blog posts, my other site is also in WordPress. – Brian O'Neill Jul 9 '12 at 19:18

Why don't you create a page, and set that as static homepage for your blog. You can even set custom template to it.

Show posts from other blog / rss feed

To show posts from other wordpress blog you can use this plugin called - RSSImporter and use a template tag <?php RSSImport(10, 'http://feedurl'); ?> To show up the feeds (posts) from other blog in your template.

To add contact form 7 to that template

create a page with short-code to show contact form in it.

Not the answer you're looking for? Browse other questions tagged or ask your own question.