• Not sure if this has been answered. I wasn’t sure how to ask.

    I want a main page that is just a standard DHTML setup (website.com) and I want wordpress installation for blog activity on a subdomain (blog.website.com)

    I’d like to just have something like a php include() to pull the ‘more’ excerpts to the main page automatically, by category. Maybe a plugin or RSS feed is best.

    This would be easier if I was pulling to a wordpress front page, but again, this is pulling to a main domain to a regular non-wordpress website.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You can try to query it with PHP…

    <?php
    if (!$link = mysql_connect('localhost', 'username', 'password')) {
    echo 'Could not connect to mysql';
    exit;
    } if (!mysql_select_db('databasename', $link)) {
    echo 'Could not select database';
    exit;
    }
    
    $sql = "SELECT * FROM wp_posts";
    
    $result = mysql_query($sql, $link);
    if (!$result) {
    echo "DB Error, could not query the database\n";
    echo 'MySQL Error: ' . mysql_error();
    exit;
    }
    
    while ($row = mysql_fetch_assoc($result)) {
    
    //This where you display the title, the contents...
    
    		echo substr($row['post_title'], 0, 46);
    		echo substr($row['post_content'], 0, 160);
    
    }
    
    mysql_free_result($result);
    mysql_close();
    
    ?>

    I created this code when I was working on one of my client’s website.
    Try to tweak it. See If it works for you.

    Thread Starter dday76

    (@dday76)

    Thanks for the info. That is a good start, so I can at least pull the info now. It doesn’t seem to have a category option. I’m not sure where to put it. And any ideas from anyone about query_posts() Is that relevant outside WordPress?

    mheltone

    (@mheltone)

    $sql = "SELECT * FROM wp_posts";
    that works like a query post…

    You can add WHERE on the query to filter the results
    $sql = "SELECT * FROM wp_posts WHERE post_type = 'page'";

    What exactly are you trying to post on your index.php?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘wordpress excerpts to non-wordpress’ is closed to new replies.