Support » Themes and Templates » Trying to add WP php…

  • Below is a section of code from an php document that I’m trying to create. The idea is to make the blog content appear within the page so that it is fully integrated with the rest of the site.

    I plan to experiment by taking bits of the php out that I don’t want, but right now I’ve taken almost all of the php right from the index of a theme, just to try to get it to display withing the page.

    So far, nothing appears. I was wondering if anyone might be able to give me some ideas as to what I’m doing wrong and/or what I might do differently.

    The rest of the page is the html tags that build the design of the page. There is no other php within this document, but only what I’ve posted here.

    Like I said, right now, nothing shows up on the page at all. If anything, this code seems to have “corrupted” some of the html tags, as some of the page is missing (which isn’t the case when I remove the php).

    ** This is the Main Body Content **
    <div class=”standard”>

    <?php if (have_posts()) : ?> // begin if statement

    <?php while (have_posts()) : the_post(); ?> // begin while loop

    <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(‘F jS, 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’, ”, ‘ | ‘); ?> <?php comments_popup_link(‘No Comments »’, ‘1 Comment »’, ‘% Comments »’); ?></p></div>

    <?php endwhile; ?> // end while loop

    <div class=”navigation”>
    <div class=”alignleft”><?php next_posts_link(‘« Previous Entries’) ?></div>
    <div class=”alignright”><?php previous_posts_link(‘Next Entries »’) ?></div>

    <?php else : ?> // begin else

    <h2 class=”center”>Not Found</h2>
    <p class=”center”>Sorry, but you are looking for something that isn’t here.</p>
    <?php include (TEMPLATEPATH . “/searchform.php”); ?>

    <?php endif; ?> // end if statement


    <!– End Main Body Content –>

Viewing 3 replies - 1 through 3 (of 3 total)
  • Is the site .html based? Meaning, the file you’re trying to plug the PHP into – is the file extenstion .html or .php?

    The file extention is .php.

    In order to be able to use any WP code (read: template tags, functions etc.) in a file OUTSIDE of your WP install, you have to make that file to “know” about your WP install.
    Put this on the top of the file (before everything):


Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Trying to add WP php…’ is closed to new replies.