Hoe te om het Werk van HTML- Pagina's zoals Wordpress te maken
7 juni, 2007 · door David Bradley
Hebt u een bos van standaardHTML- pagina's buiten uw blog hiërarchie Wordpress? Ik neem niet over' statische „Pagina's Wordpress“ met hoofdP, maar die pagina's, misschien in de wortel voorbij de faciliteit CMS van Wordpress. Goed, is er een vrij eenvoudige manier om een standaardHTML- pagina in een soort pagina om te zetten Wordpress, zodat uw header, sidebar, en footer allen teruggeven alsof de pagina een standaardpagina Wordpress was.
1. Eerst, maak een veiligheidskopie van om het even welke pagina's u van plan bent om dan deze lijn te veranderen, toe te voegen aan de hoofdsectie van elke pagina u aan re-thema binnen het systeem Wordpress op uw plaats wilt.
<? php bepalen (' WP_USE_THEMES', vals); vereis ('. /your-wordpress-folder/wp-blog-header.php'); ?>
Dat roept binnen de noodzakelijke code van de omslag Wordpress (duidelijk verandering „uw-wordpress-omslag“ in de daadwerkelijke foldernaam).
2. Daarna, beslis welke componenten u voor de pagina gaat nodig hebben. U zult waarschijnlijk header van uw thema zo toevoegt willen
<? php get_header (); ?>
Gezet dat dichtbij de bovenkant na de lichaamsmarkering.
3. U bent waarschijnlijk footer in uw thema ook geworden, voeg zo dit aan de bodem van de pagina toe vóór de dichte lichaamsmarkering
<? php get_footer (); ?>
4. Dan komt een netelig beetje. Waar te om sidebar te zetten? Het hangt af. Probeer het vlak vóór de footer markering u eerst in de vorige stap toevoegde. Wij kunnen later terugkomen en het bewegen als het niet behoorlijk werkt.
<? get_sidebar php (); ?>
5. Nu, zullen de slimme lezers opgemerkt hebben u waarschijnlijk een lading van php markeringen aan pagina's met een htm of HTML hebt toegevoegd en dat die deze in uw browser opent enkel de code gaat tonen zonder het in werking te stellen. Zo, is er één definitieve kritieke maatregel u moet treffen alvorens de dingen zoals gepland zullen werken. Stel uw.htaccess- dossier (u weet waar dat ik neemt het, wortelomslag, geen filename enkel de uitbreiding htaccess (vergeet niet de punt) open is. Maak een reservecopie. Dan voeg de volgende lijn toe:
Application/x-httpd-php .php .html .htm van AddHandler
en sla het.htaccess- dossier op. Dit zal dan browser toestaan om php in pagina's met de htm en HTMLuitbreidingen evenals de php uitbreiding te ontleden.
Paar van dingen aan horloge uit voor: als u de bovengenoemde code cut and paste, verzeker de citaten citeren rechtstreeks tekens enig zijn en de hoekijzers juiste niet grotere code en minder dan tekens zijn.
Ook, zorg ervoor u de resulterende metamarkeringen voor deze pagina's dubbel controleert, zou het in het verliezen kunnen resulteren Autodiscovery RSS or changes in your carefully honed title tags. Also, you generally will not be able to enable comments on these pages as you might do with a static Page within Wordpress proper. If anyone knows how to workaround the comments disabled default for this kind of page, please leave a comment. I’d love to enable comments across the whole of the Sciencebase.com site on which I make extensive use of this format.


















34 responses so far ↓
Why not just convert all your legacy pages (with a little p) into static pages within the Wordpress system and then relocate the subfolder to the site’s root? Job done.
That would be one way of doing things, Ben, but what if you have thousands of pages in standard html, that’s an awful lot of cutting and pasting. Also, there might be reasons why you want to keep the blog part in its own folder and have standalone chunks in the root.
I’m having a problem doing the opposite of what you instructed. I want to add a bunch of html pages on the root of my directory and having a hard time.
I would like a thankyou, about, seemore, page etc, and It keeps calling my 404 page. how do I stop it?
Thanks.l
Deb, do you mean you are trying to create static pages in Wordpress called from the homepage, or are you making standalone pages but don’t want to have them use the WP template? Please clarify and someone here might be able to assist.
First thought, did you double check the links you’re using?
db
What i want to do is create standalone pages. that don’t call the template. I want a thankyou.html page for example. And I can’t seem to get it working. it keeps calling the the template.
Also, I’ve created a folder called thankyou right at the root of the domain. added a page in it called index.html and the darn thing still calls the wp template. I am totally baffled.
Please help.
Deb, that is very odd. If you are creating the pages within Wordpress then that’s bound to happen, but if you are simply creating a standard html page and then uploading it to the root then make sure you haven’t added the includes for WP. Could you either email the source code for the troublesome pages or point me to those pages and I’ll take a look.
db
Thanks DB,
You are right. That’s exactly what im trying to do. However, i just can’t get the darn thing to work.
I am really frustrated at this point so im gonna go and hire some help. A sista can’t be waisting three days trying to figure out this techie stuff
Thanks for all your help though.
DG
please send the process of making html page
Send it where Tathagat? It’s right here. On the page
db
Hey,
I think I followed your directions exactly, but nothing is showing up on the page.
Ariela
Ariela, what is the file extension for the page? If it’s not “.php” (could be .htm, .html instead), do you have those file extensions set to be read as php by your server?
to do that, you need this line in your .htaccess file:
AddHandler application/x-httpd-php .php .html .htm
db
Thanks for getting back to me so fast…
The file extension was .php, but I ended up going in a different direction — I’m building a theme to apply to the blog that looks just like my webpage.
Thanks, though!
Ah, okay, wonder why it failed then…caching perhaps? Let us know how you get on.
You’ve got some lovely photos on your site by the way! You may care to check out my public flickr gallery
db
Hey, so I ended up building a theme that looked like my web page and everything worked, but I came across another problem, and am hoping that you have an answer. The one thing that’s not working is that the images aren’t showing up — they’re little blue diamonds with the question marks. I checked and double checked all the image paths. They are all, by the way, in the header.php and the footer.php. Any idea what I did wrong?
Thanks! (and thanks for the compliments on the photos — I’ll let the photographer know!)
That is brilliant. Technical, but brilliant. I moved from HTML to WP a year ago and had a bunch of pages I just copied over cause I was too lazy to convert them.
I am definitely bookmarking this page. Thanks!
Minnesota Investment Property’s last blog post..Stupid Property Repairs #3
Luke // Apr 23, 2008 at 3:55 am
David,
When I tried this, I got the following:
Parse error: syntax error, unexpected ‘?’ in /xxxx/xxxx on line 159
I know next to nothing about php, so I copied and pasted exactly what you typed, with the proper ‘ and .
Any ideas as to what I’m doing wrong?
Luke, you checked the single quote marks, did you check the angle brackets?
db
Luke // Apr 23, 2008 at 4:57 pm
David,
I checked those as well. I included the angle brackets in my previous post, but they must have been cut out.
I just sent you an email with more specific information.
Luke
Thanks for the follow-up. You explained in an email that you’re creating a standalone page you want to theme as if it were part of your blog, but your Wordpress blog is actually in the root of your domain, so there is actually no need to use my workaround.
Simply create a “Page” with the content you sent me, tweak the permalink and everything should be fine.
If you really must do it this way then try the code without the period before the slash, and if that doesn’t work remove the slash too.
Let us know how you get on.
db
I have a site that I need to add the current post to the top of a HTML page. Will this work for that?
What is the code just to bring in the current post?
Thanks
Bob, that should work with this code. You’d need to add the Wordpress loop (see the main index file in your template) and set it to display just one post.
db
David,
Im getting the same similar error that Luke reported.
I know that you said the following: “Couple of things to watch out for: if you cut and paste the above code, ensure the quotes are single straight quote marks and the angle brackets are proper code not greater and less than signs.”
But I dont see any quote marks or greater/less than signs to correct.
Any ideas?
Kimberley, they’re right there up above…
You have to add this to the source of your page:
You are on an Apache system, yes?
db
Okay, I went back tonight to look at the code and my ‘ were slanted… So fixed that. Im not sure it did anything. Im not getting the Parse error: syntax error, unexpected ‘?’ in /xxxx/xxxx on line 159 error anymore. What’s happening is that the page sort of loads itself, but the images disappear. The link is:
http://www.dreamsofmidnight.com/DreamsWeDreampt/index-new.html
[ Yes I know "Dreampt" is spelled wrong. Just a test folder. =) ]
Hi Kimberley and thanks for your 3 attempts and an email. All got through. Your comments did “stick” it’s just it was night here so I wasn’t at my computer to approve them. You should’ve seen a message, however, to say that comments require approval so apologies if that wasn’t apparent.
db
Kimberley (again) - I mentioned in the post that readers should check that quotes are straight and angle brackets working as html rather than being converted. But, I did take a look at your code and the javascript for rendering your images is pointing to “http://127.0.0.1:1025/js.cgi?pa&r=2401″ that’s a local (i.e. your machine) rather than the server, so that’s why they’re not showing up because the script needs to be in your root on the site server.
That said, what benefits are there to serving images via a script, why not make them absolute and then there’s last chance of things breaking, especially for users running NoScript in their browser!
db
I apologize for all the emails. I must look like a complete moron. However, there was no message showing up on the site, that’s why I thought they weren’t getting through. Sorry about that.
I’ll check what you mentioned. And get back to you.
I just did a test comment post Kimberley and once a message has been submitted you should’ve seen a little notice saying it would appear once moderated and now offering you the option to subscribe to the newsfeed.
db
Hi David,
We have a problem when trying to add the .html extension to WP Pages (with a cap P). Do you know if this is possible and how to go about this?
Thanks
Sarah
Sarah, I am pretty sure there is a workaround, but I’ve not yet implemented it and have been persuaded that there is little point as most users are blind to file extensions in URLs these days. There may, just may, be SEO benefits to having the .html, but I’m not sure what those would be.
Have you searched the wordpress forums for an answer?
Yes, but it seems to be nigh on impossible and not recommended as it involves fiddling with the source code and course there’s future updates to consider. Nonetheless, if there was a workable solution I would consider it, if only for the benefit of SEO considerations - but again as you say, what are the benefits there?
Actually, there may be hidden SEO benefits to having a few Pages on a site that look to all intents and purposes as if they are actually folder structures rather than individual files, I’m thinking Google Site Links
I’m finding way to make these structure, if possible :-
Eg ->
Page structure like this :-
domaincom/page1.html
domaincom/page2.html
and Blog Post like this ( as choosing the /%postname%/ for permanent link structure ) :-
domaincom/myblogpost/
domaincom/myblogpost2/
…and so on.
Would these be possible ?
Thanks for your kind help if there is solution.
Datas last blog post..Computer System
Data, check out the Wordpress FAQ and forums for assistance on permalinks.
Leave a Comment