Your Ad Here

Posted By

brunohstein on 12/03/10


Tagged

wordpress


Versions (?)

List Pages/Categories whitin definition lists


 / Published in: PHP
 

How to display your page or categories list within a definition list instead of the default unordered list. The first block is about pages and the second one is about categories.

  1. <dl>
  2. <dt><a href="<?php bloginfo('url') ?>">Lorem Ipsum</a></dt>
  3. <?php $pages = get_pages(''); foreach ($pages as $pagg) {
  4. $option = '<dd><a href="'.get_page_link($pagg->ID).'">';
  5. $option .= $pagg->post_title;
  6. $option .= '</a></dd>';
  7. echo $option;
  8. } ?>
  9. </dl>
  10.  
  11.  
  12. <dl>
  13. <dt>Lorem Ipsum</dt>
  14. <?php $categories=get_categories(''); foreach($categories as $category) {
  15. echo '<dd><a href="'.get_category_link( $category->term_id ).'">'.$category->name.'</a></dd>';
  16. } ?>
  17. </dl>

Report this snippet  

You need to login to post a comment.