Forums

[resolved] Page links without a list (7 posts)

  1. otherSphere
    Member
    Posted 9 months ago #

    Hello there,

    simply: is there a way to make WP to display the list of pages without creating an actual list (no <li> elements)?

    I'm working on a bilingual website (using WP_Multilingual) and there's a horizontal menu with links to some pages. Right now, I'm using this:

    <?php wp_list_pages('include=1&title_li='); ?>

    in a table (table... I know, I suck...) for each link because I need both titles and links to change, when a user changes the language - it looks like this: http://i40.tinypic.com/a3ci8z.jpg. My problem is that the code above creates

    <li class="page_item page-item-1 current_page_item"><a href="http://localhost/en/example" title="Example">Example</a></li>

    and I need to somehow remove the <li> elements. I tried everything I could think about but this is the only way that works (as far as I can say) with my bilingual web.

    Do you have any ideas?

    Thanks very much :)

  2. MichaelH
    moderator
    Posted 9 months ago #

    Here, play with this code that works in the sidebar.php of the WordPress Default Theme.

    <?php
      $args = array(
      'orderby' => 'post_title',
      'order' => 'ASC',
    	'post_type' => 'page',
    	'showposts' => 1000,
    	'caller_get_posts' => 1
      ); 
    
    $pages = get_posts($args);
          foreach($pages as $page) {
              $out .= '<li>';
              $out .=  '<a href="'.get_permalink($page->ID).'" title="'.wptexturize($page->post_title).'">'.wptexturize($page->post_title).'</a></li>';
          }
        $out = '<ul class="page_post">' . $out . '</ul>';
        echo $out;
    ?>
  3. otherSphere
    Member
    Posted 9 months ago #

    It's perfect, thank you very much

  4. otherSphere
    Member
    Posted 9 months ago #

    just in case anyone would find it useful:

    $args = array(
    	'post_type' => 'page',
    	'include' => 1,
    	);
    
    $pages = get_posts($args);
    	foreach($pages as $page)
    	{
    	$out .=  '<a href="'.get_permalink($page->ID).'" >'.wptexturize($page->post_title).'</a>';
    	}
    
    echo $out;
    unset($out);
  5. mores
    Member
    Posted 7 months ago #

    Thanks, it helped me some!

  6. kremerdesign
    Member
    Posted 1 month ago #

    Just what I was looking for

  7. vinword
    Member
    Posted 5 days ago #

    Thanks It Help Me

Reply

You must log in to post.

About this Topic