Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'll try to explain myself and what I'm trying to gain. I run a DJ business and am trying to get into the Wedding market. One way is to make sure the slug of each page has "wedding-(venue name).html for example. I've got 20 of these pages and they work really well. Problem is that the title H2 header on the page is customised to the venue name (Thinking of getting married at "venue name"?). the rest of the page is the same as the rest. Is there a way of me creating a unique page for the H2 title and then using php to call another single page or post to add underneath? This way I'll only ever need to change one post of page to change all of the pages. Hope I make sense... Cheers, Lee

share|improve this question

2 Answers 2

You can do this but before I tell you how I have to express a concern. You will have severe duplicate content problems if all of your pages are the same except for that <h2> tag.

Now, what you need to do is create a Custom Page Template, with the following:

<?php
/*
Template Name: Venue Duplicate Content Template
*/
get_header();

$special_content = new WP_Query(array('p' => 675,'post_type'=>'page'));

if (have_posts()) {
  while(have_posts()) {
    the_post();
    the_title(); // add your <h2> tag or whatever other markup you want.
    $special_content->the_post();
    the_content();
  }
}

Edit the ID to match the page with the "real" content, of course.

When you create your individual wedding-(venue name) pages, just select that template as the "Template"

share|improve this answer
    
I'm trying to add the code to the test01.html page in the WP editor (in text mode) and it's not working. It's just coming up with the code on the actual page... –  user36177 Aug 4 '13 at 0:37
    
In my experience, nowadays duplicate content is most frequent reason for google blacklist. +1 for 1st sentence. –  G. M. Aug 4 '13 at 0:38

it's not really easy to understand what's at stake here but if you want to include some page into another, there's a trick with WP_query :

<?php $page = new WP_Query("page_id=your_page_ID"); while($page->have_posts()) : $page->the_post();?>
   <h2><?php the_title(); ?></h2>
   <?php the_content(); ?>
 <?php endwhile; ?>

Hope that answers to your question.

share|improve this answer
    
Thanks for the response. I think I'm confusing myself here :-) I'll have a page called test1.html which will have some text at the top. I'll then have a page called test02.html I'd like to have the content of test02.html be shown under the text in test01.html when I browse to test01.html. Cheers –  user36177 Aug 4 '13 at 0:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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