• Resolved sailie

    (@sailie)


    I am using WP to create a web site for a group of sailors here in Ireland. Version 2.0.22, installed easily, and I have reduced and modified the Kubrick stylesheet to suit our needs. https://www.sail.ie/sb is the temporary home before it gotes live on another server.

    I have created two Pages with templates using “php include” to insert previously prepared html pages. See one such page here.

    I do not have enough CSS skill to render the html as a Page without the “include.”

    The Page resolves properly, but I would like to be able to use the Dashboard > Manage Pages > Edit Screen to add additional data beneath the “included” html. Alas, I cannot.

    Does anyone have a method of adding text and images beneath the “php include?”

    The template is:
    <?php
    /*
    Template Name: boatinfo
    */
    ?>
    <?php get_header(); ?>
    <div id=”content” class=”box”>
    <?php include (‘b_info/boatinfo.html’); ?>
    </div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Very many thanks for your help,
    Bob, in Dublin

Viewing 4 replies - 1 through 4 (of 4 total)
  • You need The_Loop to be included and then anything you put into the content area via Write Page will appear.

    Thread Starter sailie

    (@sailie)

    Thanks for your quick reply Moshu, but I cannot get The Loop to work as you suggest.

    This attempt renders a blank page with a blank “view source:”

    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php endwhile; ?>

    The same blank with the vanilla Kubrick:

    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <div class=”post” id=”post-<?php the_ID(); ?>”>
    <h2>
    rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”>
    <?php the_title(); ?>
    </h2>
    <small><?php the_time(‘j F Y’) ?>
    <!– by <?php the_author() ?> –>
    </small>
    <div class=”entry”>
    <?php the_content(‘Read the rest of this entry »’); ?>
    </div>
    <p class=”postmetadata”>Posted in <?php the_category(‘, ‘) ?> |
    <?php edit_post_link(‘Edit’, ”, ‘ | ‘); ?>
    </p>
    </div>
    <?php endwhile; ?>

    This try renders the “included” html properly, but no luck adding text via Dashboard > Manage Pages > Write Page:

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <?php endwhile; else: ?>
    <?php endif; ?>

    Any ideas gratefully receive,

    Bob, in Dublin,

    1. Your first Loop doesn’t have any template tag – so it will display nothing.
    2. In the second I don’t see your include.
    3. Try this: https://wordpress.pastebin.ca/729337

    and then create you Page by selecting the Template boatinfo while writing the Page.

    Thread Starter sailie

    (@sailie)

    Very many thanks, works a treat!

    Bob, in Dublin

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘php include on Page template, how to add code/info after?’ is closed to new replies.