| |
|
Welcome to KnowledgeSutra - Dear Guest | |
Embedding Wordpress Posts In Other Pages
#1
Posted 19 February 2011 - 08:27 PM
However, as I already have my site laid out, I don't want to embed the entire wordpress page. I only want to include the articles, but keep the formatting which I had set up in wordpress.
I tried to follow this guide but it just resulted in plain text appearing in the page, which isn't what I want.
If anyone could help me out here, that would be brilliant.
#2
Posted 25 February 2011 - 11:23 AM
My website looks similar on all pages, I have just made 2 tables, one on the left, where the menu appears, and one on the right, where the main page (as chosen in the menu) appears.in the main table,
I want to keep it like that, only, for my news pages (Dutch and English), I just want the layout left intact, except that, in the main table, I want the
articles to appear as Wordpress blog posts, rather than just separate tables with text and pictures in it.
I have made a screenshot to show what it looks like at the moment, sorry there is only one bit of a table visible in the main section (on the right), but it concerns a very long article here, but, anyway, anythig that appears below is just the same, ie. a table, with the date top left, the title of the article under neath, and then the main text of the article.
The main reason why I am posting this here is because the Wordpress support is not always very clear to search, and the explanations are sometimes difficult to understand, and also, because the forums are not always very helpful neither.
Anyway, here is a screenshot of my news page:
newspage.png 46.85K
8 downloadsHope that makes things a bit easier to understand.
#3
Posted 25 February 2011 - 10:30 PM
mrdee, on 25 February 2011 - 11:23 AM, said:
My website looks similar on all pages, I have just made 2 tables, one on the left, where the menu appears, and one on the right, where the main page (as chosen in the menu) appears.in the main table,
I want to keep it like that, only, for my news pages (Dutch and English), I just want the layout left intact, except that, in the main table, I want the
articles to appear as Wordpress blog posts, rather than just separate tables with text and pictures in it.
I have made a screenshot to show what it looks like at the moment, sorry there is only one bit of a table visible in the main section (on the right), but it concerns a very long article here, but, anyway, anythig that appears below is just the same, ie. a table, with the date top left, the title of the article under neath, and then the main text of the article.
The main reason why I am posting this here is because the Wordpress support is not always very clear to search, and the explanations are sometimes difficult to understand, and also, because the forums are not always very helpful neither.
Anyway, here is a screenshot of my news page:
Hope that makes things a bit easier to understand.
I had a look at the example link where you are using as a guide. Your main problem is it has no styles correct? I think this is probably due to a setting you've set in the first snipplet of code
<?php
// turn off WordPress themes and include the WordPress core:
define('WP_USE_THEMES', false);
require($_SERVER['DOCUMENT_ROOT'] . '/wordpress/wp-blog-header.php');
?>
I'm guessing the WP_USE_THEMES = false will cause wp to output your content in just plain text. I have no personal experince of word press my self so I am only guessing that is what is happen. If that is the case then maybe you can try turn it on just to see the effect. If that still does not do what you need then it may look like you need to somehow create your own CSS to format it. You can probbaly do this by getting at your table container and selecting what ever child elements underneath it to style it as you please.
Could you possible paste the entire html code generated by your page I would be interested to see what it actually outputs.
#4
Posted 26 February 2011 - 10:56 AM
If you want to use some of the WordPress for something else and some of the articles for your news page, I don't know. I guess you could have 2 WordPress installations for each but I wouldn't recommend it's too complicated.
And, for embedding WordPress I guess you'd have to do so many file includes (to load the wp core and connect to database) that by then you could just make a half-theme.
Also, you shouldn't use tables for your layout.
EDIT: I just found something that might help. Just remember that after you load the core through the header you have to write out the php to get the posts as well.
Edited by Baniboy, 26 February 2011 - 11:04 AM.
#5
Posted 26 February 2011 - 01:26 PM
thank you for the replies.
And, Baniboy, the solution looks difficult (I'll come back to that in a minute), but the first thing I noticed, and something that bugs me is when you say: "Also, you shouldn't use tables for your layout.".
You are probably right, but could you say what the problem with tables is, and also: what else was I supposed to do then?
I wanted the menu to appear on the left hand side of the page, and I also wanted it to stay in its proper place, that is why I used tables.
In the old days, I would have used frames, but apparently, they are practically completely obsolete.
Now, for your other advice:
It does look quite complicated and long-winded, but my site uses predominantly HTML, I only use PHP for special features, such as my greeting cards, or forms that appear on my pages, however, the link you included will be of help to me if i go through it step by step.
I have also installed 2 copies of Wordpress locally to do some practice (it does not matter then if I mess something up).
By the way, the two copies are (as far as I could make out from Wordpress support) becaus my site is bilingual, so I installed a Dutch and an English copy.
By the way, I have a funny experience when trying to add a new post: The title field is fine, a cursor flashes in it and I can just type my title in. However, in the main body of the post, everything I type is invisible, all I can see is some red underlining.
I can only see what I have typed by highlighting, I have looked for a setting to change the text colour, but with no luck.
Is it a bug, or would it have something to do with the fact I am running it locally?
I certainly cannot find anything in Wordpress support.
Anyway, I shall follow your advice, and the advice on the page you referred me to step by step and see where I end up.
Once again, thank you, everyone, for all the good advice.
Edited by mrdee, 26 February 2011 - 03:01 PM.
#6
Posted 26 February 2011 - 06:03 PM
About the tables thing... well, content inside tables doesn't show up until ALL of the content inside it is loaded. Also, I have heard tables slow the page down. Someone viewing your website on a cellphone might not like it that much. There are, of course, other reasons. Mainly I think it's a trend. Users won't probably care or notice, but see how when ks loads the main page? You have to wait for it to load each table's (the forums list) content before it shows it. Well, you can't notice it normally, but I use my phone to browse here and I do notice it. And tables are (for me, atleast) harder to understand and visualize instead of a div structure. But, if you have a lot of nested divs it'll be hard to understand that as well so I guess it doesn't matter if you don't put tables in tables or something like that.
IF you do want to change it, however, I have posted a tutorial on this. Though I'm not sure if it's that good because I didn't explain things separately, but just put the code and explained it in CSS comments. LINK
About your posting problem, I have no idea. Try going to the "HTML" tab in the posting window and see if WordPress has added anything that alters the color.
#7
Posted 26 February 2011 - 06:59 PM
First of all, it is indeed only the news page (or rather, both, the English and Dutch one) that I want to work on Wordpress.
They also get updated regularly (at some times even daily, or more than once a day, depending on the importance of the current news).
I will also have alook at the tutorial you posted and see what i can come up with.
About my editing problem in Wordpress: the funny thing is (forgot to mention that) that the "Visual" and "HTML" tabs do not react to mouse clicks at all.
Also, the "Help" button and the "Screen Settings" button (this name might be wrong here, but it is something similar), at the top right of the page do not yield any reaction whatsoever to mouse clicks, I can't test a "live" Wordpress version at the moment, so I am not sure whether it is a bug, or whether it has something to do with the fact that I am running Wordpress locally (with Apache and WAMP, etc.), maybe time will tell.
I have also tried to copy and paste HTML from my existing page into the edit box, and that gives me a "This post can not be found" error when doing a preview.
Oh, by the way, I am using the latest version (3.1) of Wordpress.
Nevertheless, thank you so much for your continuous input.
#8
Posted 26 February 2011 - 09:56 PM
#9
Posted 28 February 2011 - 01:03 AM
However,it might work fine, and I may be able to write articles and lay out my pages properly, the integration into my existing page seems to be a big no-no.
I tried to follow the instructions on the link I was given, regarding integration of a Wordpress page in my existing page, so I copied the news page of my existing website, left the left table (with the menu) intact, and cleared the right frame, except for the table tags.
Then, according to the instructions, in the table on the right, I copied the following:
<?php
/* Short and sweet */
define('WP_USE_THEMES', false);
require('http://127.0.0.1:8888/wordpress/ndl/wordpress/wp-blog-header.php');
?> A little explanation: the "http://127.0.0.1:8888/" bit is because I run Worpdpress locally at the moment (via EasyPHP), and the rest of the line is because, according to the instructions, I made a second folder into the wordpress folder, where the Dutch version of my Worpress resides.
The folder is called "ndl", and inside is the full Wordpress structure again, but then with Wordpress 3.1 in Dutch.
It looks like both languages work.
Anyway, I called this file 'index.htm' and put it in the root directory of the local site first, where I was greeted with either a blank page where the code was to appear, or, in the beginning, I saw
Quote
I then also moved the page to the root directory of the Dutch Wordpress, also called 'index.htm', but the result was the same, a blank page in the right hand half of the page.
I also tried two more snippets that were recommended by the tutorial site, one that was supposed to show all the posts, and one that was supposed to show a certain number of posts:
<?php
require('http://127.0.0.1:8888/wordpress/ndl/wordpress/wp-blog-header.php');
?>
and
<?php
$posts = get_posts('numberposts=10&order=ASC&orderby=post_title');
foreach ($posts as $post) : start_wp(); ?>
<?php the_date(); echo "<br />"; ?>
<?php the_title(); ?>
<?php the_excerpt(); ?>
<?php
endforeach;
?>
The result?
Well, every one of those, pretty much showed me the same: an empty right half of the page staring me in the face.
The experts among you (or certainly more advanced people) will probably see that I am being very clumsy here, but I have tried all sorts of possibilities, and at least one thing is very consistent: the result is the same every time.
So, with what I have tried to describe here as accurately as i could, has anyone seen yet where I am going wrong?
Thanks for all the help so far (although I seem to end up getting grey hair).
Alos, at the risk of repeating myself: the reason why I am trying out Wordpress locally on my machine at the moment is because I do not want to run the risk of doing some irrepairable/very deifficult to repair damage to my existing website.
Edited by mrdee, 28 February 2011 - 01:08 AM.
#10
Posted 07 March 2011 - 08:07 PM
So are you using frames or tables now? Anyway, the index.htm is wrong. It's supposed to be a PHP file, so rename the file to index.php.
I don't know how using frames affects the WordPress code, but I do smell some trouble with that.
EDIT: I'm also not sure what happens when you have nested WordPress roots. What I meant by changing the URL was that you did it through the settings menu, not change actual file structure. Not sure if this is what you meant by the "instructions", tho.
Edited by Baniboy, 07 March 2011 - 08:14 PM.
Reply to this topic

1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users














