Getting regular php pages to work in wordpress
-
I’m struggling with getting content into my pages.php on the admin panel. I’d rather get my regular php pages into wordpress. ex: aboutme.php, info.php. How do I do this?
-
Couldn’t you just create a link to link to each page?
What do you mean link to link?
I think what he means is you can go to WRITE in the admin, write a PAGE, and in the text for that page, put a link to your existing code, such as
<a href="http:/example.com/allaboutme.php">Click here to read about me</a>
This page will show up in your Pages sidebar… it’ll be a double-click, of course, but that’s one way to do it.
thanks..will it show up in the wordpress content area like where the blog is and will it include the header and everything else?
I think I’m confusing people. Sorry if I am. Basically I have php pages (about me.php) that I want to show up in the same area where all the other content shows up when you click the link.So basically its a non wordpress page that I want to make compatible with wordpress. Is there some type of code or should I try to do what u explained above?
I was looking at this tutorial and it said to do this which i tried but it didn’t work unless I am doing something wrong with the /home/USERNAME” part or something else.
But this is what the tutorial said:
If you use WordPress and you would like to have your layout on every page that you make that is non-wordpress pages (any pages that is generated with your blog), for example your “visitors” page. So if you skinned your site and use WordPress, you might need to change all of your pages and add these snippets
1. Add this snippets to the very top of your page. Just remove the spaces between < ? and at the end ? >.
< ?php require_once(“/home/USERNAME/public_html/wp-blog-header.php”);? > < ?php get_header(); ? >
2. Edit the USERNAME part of the snippet above and you might change the path a bit if you saved your WordPress files in a different folder. If you saved it in your root directory, then just edit the USERNAME part. Now, add this code underneath the page. Do the same thing as above, remove the spaces between < ? and ? >.
< ?php get_sidebar(); ? >< ?php get_footer(); ? >
ok, let me make sure we’re talking about the same thing.
If I go to yadda.yadda.com/aboutme.php you want that to _look_ as though it was a page in your wordpress blog, and this visual appearance is what you mean when you say “compatible with”
If that’s right, then your post above is headed in the right direction.
Your yadda.yadda.com/aboutme.php has to have some additional PHP code added to it. Basically, you have to call out to the wordpress header and sidebar code…
So, at the top, above all your content, you have to call out to yadda.yadda.com/wp-blog-header.php, which is _somewhere_ in your path, but since we don’t know where it is, we’re going to pretend we do and tell you to
require_once(“/some/stupid/path/I/don’t/know/wp-blog-header.php”)
and then you have to add the sidebar and footer code in the appropriate places.
If your aboutme.php generates it OWN headers and footers, you have to do away with them, and if it did the whole business (you know, the html/body/etc stuff) then you have to strip THAT out.
If your aboutme.php page is using smarty templates, then this is going to get REALLY TRICKY and you’re going to want to do some substantial research.
No, I was suggesting just using Administration > Blogroll > Add Link.
If you require these links to be actual Pages, then you want to use something like the Redirectify plugin. Besides installing and activating the plugin, this would require creating a Page and Publishing it, then edit the page and add the Custom Field key redirect and a value of the URL of the actual php you want to present.
->michaelh can you point to an actual usage of your suggestion? I’d like to see it in action somewhere!
Wow Michael, that is a _very_ odd piece of code. (Redirectify) but isn’t all it accomplishes simply LEAVING the site and ending up somewhere else entirely, while still having a POST database entry?
Wouldn’t simply linking the external code in with an iframe to appear inside the post leave you -in the blog- so to speak?
@longtex–don’t have something to show you, just download the plugin and try it.
@rboatright–my suggestion for the redirectify plugin is useful only if you want to present a Link under your menu of pages that takes you to another link.
@evette said “I want to show up in the same area where all the other content shows up when you click the link” so guess we need to know exactly that that means. Evette do you have a link where we can see where you are talking about?
yehh the page where I got the tutorial from https://www.xoxmariah.com when you click visitor or contact at the top of her site. It says wp-content/you.php or form.php.
I havent tried the plugin yet or anything else because Im using the computer at my moms house right now and none of my stuff if on here. I’ll be sure to try to when i get back to my place and let you know if any of the suggestions worked
Thanks so much for all the help
->michaelh: just a stupid question… if you don’t know of someplace it IS working, what makes you sure it WILL work?
longtex–I’ve tested it.
In this code:
< ?php require_once(“/home/USERNAME/public_html/wp-blog-header.php”);? >
is username asking for the FTP username? For some reason the code is not working. I’m doing something wrong. I don’;t know what it is.
This is what i did:
< ?php require_once(“/home/MY FTP USERNAME/public_html/wordpress/wp-blog-header.php”);? >evette,
you are over complicating that..
Pretend your wordpress blog is installed in:
/home/YOUR_USERNAME/public_html/
if the php file you want to use that include in is also inside /home/YOUR_USERNAME/public_html/
then you do this:
<?php require('./wp-blog-header.php'); ?>
the ./ at the beginning means the same directory.
If the file you want to use the include in is located here:
/home/YOUR_USERNAME/public_html/myspecialfiles/
then you use this:
<?php require('../wp-blog-header.php'); ?>
the two dots and the slash ../ mean to look for the file one directory up …
Does that help?
omg thanks wooami, that worked = ]
the only problem now is that my header image disappeared its just a blank space with a [x] in the corner ( well many blank spaces because the image is sliced.
im using < ?php get_header(); ? > so why is it doing this?
- The topic ‘Getting regular php pages to work in wordpress’ is closed to new replies.