Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

How do I selectively plugin WordPress to a static site? WordPress

  • SOLVED

**UPDATE**
Okay, bag the idea of selectively using WP. I need to learn how to manage the software. Who has the patience to walk me through this?? Prizes for this question will be awarded independently and this will be a separate hire. Is it okay to ask that on here? Hope I'm not offending any site rules. Thanks for letting me know.

**Original**
I'd like to add a blog-like function to our static website. Ideally this will include a page that can be styled to match the rest of the site, but behaves like a blog with dynamic content, a back-end user interface, etc. Ideally, the entire site will have accessibility to WordPress for other dynamic components should we like to add them down the line. WordPress is already installed, and the framework for the site is built. I now, need help "calling on" the WordPress database to integrate the two. Does this make sense? Can you help?

A friend suggested that I setup Apache/PHP/MySql to work on my machine in order to stage the site before we go live, but warned it was complicated. Is this what I need to do? Can someone walk me through this?

Answers (8)

2012-05-30

John Cotton answers:

You can add WordPress in a sub-folder on your static site and theme it to look like the main site.

It's described to some extent [[LINK href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory"]]here[[/LINK]].

With WP in a folder (say, blog), the top level pages (and other sub-directories) will act as now but users will get to see WP output when they visits yourdomain.com/blog.

The challenges are going to be creating a WP theme to match your existing site (depending on your layout, could be fiddly) and then the probably inevitable desire to have cross over between them.

Have you thought about making the whole thing WordPress with existing static pages recreated as WordPress pages?


little D comments:

Site is brand new and can easily at this point be created entirely as WordPress. Is that just a better way to go? I thought it might be easier to selectively plugin WordPress only as needed for some reason. Design is incredibly simple. WP is total overkill for most of the site.


John Cotton comments:

<blockquote>Site is brand new and can easily at this point be created entirely as WordPress. Is that just a better way to go? </blockquote>
Almost certainly.

Even if the functionality of WP is overkill now, it might not be one day. And adding even a single page is going to be 10 times easier with WP than hand editing HTML.

I've just had a similar project to this - existing static page site, wanting some blog pages.

We moved the whole thing over to WP and life is now easier for all.


little D comments:

Okay, then. Embarassed to admit, it's been nearly 6 years since I've worked with WP because my last experience was a disaster. You've all given helpful answers at this point, but folks are backing up Cotton's suggestion to generate a full WP site. So, now what? Are there themes which are easier to cannibalize? Preferably free, this is for a non-profit.


John Cotton comments:

Here's a [[LINK href="http://speckyboy.com/2011/04/25/10-html5-ready-blank-bare-bones-and-naked-themes-for-wordpress/"]]good list of blank themes for WordPress[[/LINK]]. I've used by Roots and HTML5 Reset in the recent past and am happy with both.

Of course, if your site is simple in design, you could just child-theme 2011. Sometimes just changing the header.php and footer.php files is enough to produce a different but effective site.


little D comments:

Great recs, thank you! I've downloaded a theme. How do I install it?


John Cotton comments:

Upload the ZIP via Appearances > Themes on the dashboard, or just FTP the files to the themes folder.


little D comments:

There is no themes folder, only a folder named "theme-compat". If I upload them there, it appears as though I will be overwriting the existing style info. I'd rather not obliterate a back-up option during development. Am I in the right place?


John Cotton comments:

If you've installed WP correctly, you should have a series of wp-*.php files in the top level directory and then a structure as follows:

/wp-content/themes

If you've not got that, then perhaps you should install again.

If all this is a bit unclear to you, you might be best to hire a developer.

Or do your hosting with a WordPress specialist like [[LINK href="http://www.wpengine.com"]]wpengine.com[[/LINK]] which handles all the installation and maintenance for you.


little D comments:

Wrong path. Ignore that. I found it. Thank you. My, that is straight forward!


little D comments:

I hate jargon, because I worked with a brilliant coach for half a decade who was self-taught and provided a million short cuts. I was spoiled. When you say: <em>"Of course, if your site is simple in design, you could just child-theme 2011. Sometimes just changing the header.php and footer.php files is enough to produce a different but effective site."</em>

Do you simply mean to edit the stylesheets? If so, this is what I meant by cannibalize the style sheets. Spare the unnecessary styling for basic site functions, but edit as you say the header and footer. Are we on the same page? Or is there something more to a child-theme?


John Cotton comments:

There's s difference between jargon and technical terms. Sadly the latter is necessary otherwise we'd never know what we're all talking about!

You should never edit any of the core code (or themes). Anyone who tells you to do so should be ignored.

The default twenty-eleven theme can be used directly with it's dashboard settings appropriately set. Or, you can create a child theme and selectively override elements of it.

You need to [[LINK href="http://codex.wordpress.org/Child_Themes"]]read here[[/LINK]] if you want to go the child theme route.


little D comments:

I fully appreciate the need for technical terms, thank you for the informative link. I'm sure I've also created a child theme in the past and it sounds like my past disaster with WP may have been related to editing the core style sheet in addition to several child-themes that were being used.

Holy cow. Quite the unraveling of bad ideas this has been. Thank you, tiwce. I can already tell what my next post will be about. haha. I will start a new thread. You experts need to divvy up these award duckets.

Another elementary question. I have currently created a static HTML/CSS site as a "splash page" while we are in development. It is at the same url where the WP is installed. I think this will present battling index pages and prevent me from viewing the site as I go. I'd love to install Subversion, but at the very least I should drag the files to my dev site.

Is this "installing" WP and will I need to re-establish passwords on the dev site in order to use it?


little D comments:

Nah. Figured that one out on my own.

2012-05-30

Clifford P answers:

Even if it's a single-page website with no styling, just do it in WordPress without any fancy plugins or themes or anything. Just do it. :)

P.S. You can go into your Settings -> Reading and then select PAGE1 to be Home Page and PAGE2 to be Blog Page (just create a page called "Home" and a page called "Blog" before you go to Settings -> Reading). If you put content in the Home Page page, it'll display. If you put content in the Blog Page page (and it's set as the Blog Posts page in Settings -> Reading), then nothing in the editor on that page will display on the front end.

Just do WP.


Clifford P comments:

You can use DesktopServer. It includes MAMP. Get it for free at http://serverpress.com/products/desktopserver/


little D comments:

MAMP. Thanks for the vote of confidence. I've downloaded and installed it. I'm staring at it. I know it wants to help me, but I'm seeing an undesirable learning curve and hating myself for the short deadline. I'll look forward to learning this advantage later, but am going with a dev site for now. Thank you!

2012-06-02

Arnav Joy answers:

please have a look into this link for installing themes

http://codex.wordpress.org/Using_Themes


little D comments:

Oh thank you. I'll need to use a child-theme we think. You have all been so very helpful.I'm overwhelmed.

2012-05-30

Francisco Javier Carazo Gil answers:

Hi Laura,

You can use directly SQL database of WordPress, I can help you making queries. Another options is doing the same using WordPress API, it's heavier but maybe easier.

Give me more data. If you want send me specification and I make queries for you.

2012-05-30

Kailey Lampert answers:

I'm just backing up John Cotton here.

If the site can be converted to be *all* WP instead of just the blogging portion, then go that direction.

If the static pages are currently editable, it makes sense that they have the same admin interface as the blog. And if they're not currently editable, they easily can be with WP. Adding/removing/editing pages will be so much simpler than static HTML.

2012-05-30

Agus Setiawan answers:

hi,

this is very easy, here's the procedure :

1. Add the following PHP code to the top of your static PHP page

<?php
// Include WordPress
define('WP_USE_THEMES', false);
// Change path below to location of wp-blog-header.php on server
require('/home/username/public_html/blog/wp-blog-header.php');
// Change number below to show 1 or more post excerpts
query_posts('showposts=1');
?>
note : change username with your right folder on your hosting

The above code should be the first code on the page. Example shown below:

<?php
define('WP_USE_THEMES', false);
require('/home/username/public_html/blog/wp-blog-header.php');
query_posts('showposts=1');
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<!-- HTML code continues... -->

2. Now you will need to add some PHP to the page where you want the excerpt to be displayed. An example is shown below:

<?php while (have_posts()): the_post(); ?>
<h4>Latest Blog Post on <?php the_time('jS F') ?></h4>
<p><strong><a href="<?php the_permalink(); ?>" title="Read full post"><?php the_title(); ?></a></strong></p>
<?php the_excerpt(); ?>
<?php endwhile; ?>

now you can call all plugin function for another purpose on your static pages.

if you need help to put the code, i can help you.

hope thats help.

2012-05-31

Albert Shala answers:

Your friend is correct, you should install a local virtual machine, if on OSX get MAMP or XAMP on windows and do the changes locally. Since you want a blog which would should probably look like your current site, it would best to style all the templates, so basically you get the posts and pages looking identical, so to backup John Cotton's reply above, after all it might end up being easier to do it that way in the long run.


little D comments:

Do I still need to do this if I intend to style everything through WP?


Albert Shala comments:

How do I reply to messages on here?

<strong>In response to: Laura D says:

Do I still need to do this if I intend to style everything through WP? </strong>

You will eventually need to style everything, usually for a simple site, the blog is probably the most tedious to style as there are posts, archives, authors, month, etc etc pages that are related to your blog and need to be styled to have a consistent site / blog, so everything looks identical. You will eventually be styling everything, like your p, h1-h6, img tags once you style them you can reuse for your blog and site, so with that in mind a little planning on how things might look will go a long way.

Hope that helps.


Albert Shala comments:

Discard that whole part on how to reply part in the previous post.

2012-05-31

Mohit Aneja CSSJockey answers:

Hi,

You can call wp-load.php on any static page and all WordPress functions will be available on that page.

require_once('../../path-to-wp-load.php');

Once you have this file called on that page you can use WordPress loop and other in-built functions to call posts on that page.

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

<!-- here you can add the title and excerpt or content of the posts -->

<?php endwhile; ?>

<!-- post navigation -->

<?php else: ?>

<!-- no posts found -->

<?php endif; ?>

This will save you a lot of time to create a WP theme as per your site existing design and structure.

Let me know if you need further information on this.

Thanks,

Mohit Aneja
CSSJockey.com