Buying How to Display recent post outside blog

Discussion in 'Services' started by doga, Jan 2, 2010.

  1. #1
    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
     
    doga, Jan 2, 2010 IP
  2. dotcompals

    dotcompals Prominent Member

    Messages:
    2,906
    Likes Received:
    255
    Best Answers:
    0
    Trophy Points:
    320
    As Seller:
    100% - 0
    As Buyer:
    100% - 1
    #2
    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
     
    dotcompals, Jan 2, 2010 IP
  3. doga

    doga Well-Known Member

    Messages:
    822
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    148
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #3
    Thanks but i do not wants to use feeburner to display my own site content through them.
     
    doga, Jan 2, 2010 IP
  4. NetworkTown.Net

    NetworkTown.Net Well-Known Member

    Messages:
    2,022
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    165
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #4
    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):
     
    NetworkTown.Net, Jan 2, 2010 IP
  5. doga

    doga Well-Known Member

    Messages:
    822
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    148
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #5
    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 "
     
    doga, Jan 2, 2010 IP
  6. krishmk

    krishmk Well-Known Member

    Messages:
    1,376
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    185
    As Seller:
    100% - 2
    As Buyer:
    100% - 0
    #6
    <?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:
     
    krishmk, Jan 2, 2010 IP
  7. doga

    doga Well-Known Member

    Messages:
    822
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    148
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #7
    Thanks problem fixed by krishmk code payment sent to him.
     
    doga, Jan 2, 2010 IP