wp_list_cats into an html homepage - how?

Discussion in 'PHP' started by explorer, Dec 22, 2006.

  1. #1
    wp_list_cats is used to display wordpress categories in a navigation menu.

    I'd like use wp_list_cats on my non-wordpress, html homepage so that the wordpress navigation menu is displayed on the homepage.

    I'm not sure how I should write the code on the homepage to bring wp_list_cats in from the wordpress folder.

    Any help would be much appreciated.

    Thanks :)

    p.s. .htaccess already allows php to be parsed and I have a number of working .inc files on my .html pages.
     
    explorer, Dec 22, 2006 IP
  2. maiahost

    maiahost Guest

    Messages:
    664
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Well right now I have a WP MU with a bit different database but something like this :
    
    <?php
    //remember to include db_connection and select the proper database
    $result=mysql_query("SELECT * FROM 'wp_categories' order by 'cat_ID'")
    while $row=mysql_fetch_array($result) {
    echo '<a href="http://domain.com/blog/category/'.$row["cat_name"].'/">'.$row["cat_name"].'</a><br>';
    }
    ?>
    
    PHP:
    Should do the trick - remember that category link should be matched to your site as well as change the domain.com :)
     
    maiahost, Dec 22, 2006 IP
    explorer likes this.
  3. explorer

    explorer Well-Known Member

    Messages:
    463
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    110
    #3
    Thank you :)
     
    explorer, Dec 22, 2006 IP
  4. frankcow

    frankcow Well-Known Member

    Messages:
    4,859
    Likes Received:
    265
    Best Answers:
    0
    Trophy Points:
    180
    #4
    uhh, but make sure the homepage is .php, not .html, or this won't work at all
    also, you'll need to include the database credentials to be able to connect
     
    frankcow, Dec 25, 2006 IP