Jump to content


Photo

How to display blog posts?


  • Please log in to reply
1 reply to this topic

#1 themovieaddict

themovieaddict
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 04 August 2006 - 06:04 PM

Hi,

I've just installed WordPress on my server and essentially what I'd like to do on my website is use WordPress to post news updates. I was wondering how to display posts from a category on a .PHP page of my website.

Example: let's say the index page of my website is "/index.php" and the main page is my site template with room for text in a large table below. How do I put my blog posts inside that table? Is there some type of include code I'd use to grab posts from the blog?

Thanks in advance for any help. :)

#2 hackerkts

hackerkts
  • Members
  • PipPipPip
  • Advanced Member
  • 593 posts
  • LocationSingapore
  • Age:18

Posted 05 August 2006 - 12:13 PM

Wrong section, you should be posting them in 3rd party script.

Hmm.. Read up the FAQ, there's example for getting datas from database.

Below is just an example,
<?php
$query = "SELECT * FROM wp_posts WHERE post_status ='publish' ORDER BY ID DESC";
$result = mysql_query($query) or die("Query Error " . mysql_error());
while ($row = mysql_fetch_assoc($result))
{
	echo $row['post_content'];
}
?>


Regards,
hackerkts

To be a coder, you must learn how to think and not to give up so easily.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users