Jump to content

making non WordPress pages blend with WordPress theme


Go to solution Solved by JonnoTheDev,

Recommended Posts

NEWBIE ALERT.  Here comes another newbie question...

 

Most Internet searches I have made regarding my next question indicate many people are trying to learn how to make their WordPress theme look like the rest of their website. They want to make the theme's fonts, etc. match the look and feel of their existing site. I am trying to do just the opposite.

 

I'm using the latest "Attitude" theme by Theme Horse and I like it very much. It is clean and minimalistic--exactly what I am looking for.

 

However, I am developing/running a quiz program in PHP that uses pages that were not generated by WordPress. I would like these pages to have the same "look and feel" as the native WordPress pages. 

 

It appears to me that there is rarely, if ever, any such thing as a single "page" in WordPress because all the "pages" are actually generated on-the-fly by a maze of interconnected php files, MySQL databases, and stylesheets.  What a complicated thing it is!

 

Are there a few lines of code which I could insert into a header or something like that to make these pages mimic  the "look and feel" of their surrounding WordPress pages? If not, maybe I could at least figure out how to use the fonts from the theme to make my PHP pages look like they belong to the rest of the WordPress installation.

 

If I had it my way, I would run my quiz program from within the native WP pages, making this a moot request, but I haven't yet figured out how to do that either.

 

In addition to studying any replies to this question, I also plan to study the recommendations posted by QuickOldCar on 17 October 2013 - 04:42 PM to BorysSokolov regarding the anatomy of a WordPress theme, etc.  That's for the bigger answer, but I'll keep this question here too because it is more specifically for the answer I'm looking for.  Probably, if I could learn to write my own WP theme, I could figure out how to adapt my non-WordPress pages to behave well in a WP playground and/or make my non-WP content work within the WP framework and display correctly inside WP pages.

 

Thanks.

Edited by rghollenbeck

Surely it's as simple as including your header and footer files?

 

Look at single.php and use it as a template. Just replace the Wordpress loop, with what ever content you want to appear on that page.

Thanks.  

 

I pasted the contents of single.php into my page (eval.php), pushing my content to the bottom. Once I figure out where to insert my content into this new template, I'll do that.  But first, I must be missing an include statement or something because my error_log tells me:

Call to undefined function get_header() in /~mypath~/public_html/eval.php on line 13

 

 

 

Line 13 looks like this:

<?php get_header(); ?> //line 13

I got a good book on PHP yesterday (Welling and Thompson 4th edition) and I'll start reading it today.  Meanwhile, I'll study that other clue (http://codex.wordpress.org/Theme_Development) to learn more about how WordPress is organized.  

 

Thanks andrew_biggart.  You helped me start finding the way, but I'm not quite there yet.  I would still like to get this resolved.  I now plan to use single.php, as per your suggestion, as a clue to help me get started, but I need to make it work first.   :)

  • Solution

If your quiz section does not use any of the wordpress codebase then do not attempt to integrate it in.

 

A 5 minute job is simply go to your website homepage (or a page that runs on wordpress) in Firefox (or whatever browser you use), right click on the page and select view source. Copy the source and paste it into your PHP editor. There is your base template. Add your quiz php code into the relevent parts of the template. Job done.

 

Its quick and dirty but it will save you a headache.

Yes, neil.johnson, it is "quick and dirty" and WordPress still thinks it is the original file (perhaps I still need to strip away some code, one statement at a time), but it does the job for now.  Thank you very much.

For the future can look here.

http://codex.wordpress.org/Page_Templates

 

The basics:

Create a new file in your current themes folder named what would like, lets call it quiz.php

 

Add the following code into quiz.php

<?php
/*
Template Name: Quiz
*/
?>

<?php get_header(); ?>

<style>
<!--
  div.quiz {
    width: 80%;
    text-decoration: none;
    text-align:center;
    margin-top:0px;
    margin-bottom:0px;
    margin-right: auto;
    margin-left: auto;
    padding:0px;
    }
-->
</style>
 
<?php
echo "<div class='quiz'>";
 
echo "quiz code gets added this area";
 
echo "</div>";
?>
 
<?php get_footer(); ?>

In the dashboard create a new page named Quiz, select the quiz template located lower right area, publish the new page

 

You may also add the sidebar or anything else you desire.

Edited by QuickOldCar
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.