Hello All, I will pay $5 if anyone let me know how to fix this error. I want to display my blog recent post on main page of website. my blog is in http://website.com/blog/ and i want to display recent post on http://website.com/ I have gone through all wordpress but not able to workout. I am using this code to show Code: <?php require('/the/path/to/your/wp-blog-header.php'); ?> <?php $posts = get_posts('numberposts=10&order=ASC&orderby=post_title'); foreach ($posts as $post) : start_wp(); ?> <?php the_date(); echo " "; ?> <?php the_title(); ?> <?php the_excerpt(); ?> <?php endforeach; ?> Code (markup): but then it shows following error Fatal error: Cannot redeclare clean_url() in /public_html/blog/wp-includes/formatting.php on line 2153 Not able to figure out how to resolve this error
use this code to display your latest blog posts <p> <script src="http://feeds.feedburner.com/worldclick?format=sigpro" type="text/javascript" ></script> </p> Code (markup): please replace http://feeds.feedburner.com/worldclick?format=sigpro with your own feed URL. you can see the demo at my site
Have you tried removing: <?php require('/the/path/to/your/wp-blog-header.php'); ?> Code (markup): It looks like a file has been included twice and it trying to define a setting twice by the error. or replace it with <?php require('/public_html/blog/wp-config.php'); ?> Code (markup):
I tried as you said but its again start giving same error "Fatal error: Cannot redeclare clean_url() in /home/bollywoo/public_html/blog/wp-includes/formatting.php on line 2153 "
<?php # Add your database details here $hostname = "localhost"; $dbuser = "username"; $dbpass = "password"; $selectdb = "db_name"; $con = mysql_connect($hostname, $dbuser, $dbpass) or die(mysql_error()); $select = mysql_select_db ($selectdb, $con) or die(mysql_error()); # order by id so that we can grab the 10 recent posts $query = "SELECT * FROM wp_posts WHERE post_status = 'publish' ORDER BY id DESC LIMIT 10"; $result = mysql_query ($query, $con) or die (mysql_error()); while ($row = mysql_fetch_array($result)) { $date = $row['post_date']; $title = $row['post_title']; $excerpt = $row['post_excerpt']; $link = $row['guid']; echo ("<h2>$title</h2>\n <p>$excerpt</p>\n <a href=\"$link\">Read More</a>"); } ?> PHP: