• Hi, I need some help, I have a horizontal menu that uses the css sliding door technique and it works pretty well, however I added to the menu items this <?php wp_list_pages(‘title_li=’); ?> so it can dinamically list pages.

    The problem is the output.
    the list item with the sliding door effect:
    <li><a href="https://localhost/"><span>HOME</span></a></li>

    and the list item for pages:

    <li class="page_item"><a href="https://localhost/page1/" title="Page1">Page1</a></li>

    To fix my problem the output for each page should include a <span> tag, that’s what my css is using to build the effect but I don’t want to edit the wp core file, is there another solution?

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • I would like to do this. I am beginning to think we need to write our own function. ??

    Try this:
    https://www.ads-software.com/support/topic/125142?replies=12#post-586322

    Let me know if that works (obviously, add SPAN tags to the way the links are displayed).

    Thread Starter googlebot

    (@googlebot)

    Try this:
    https://www.ads-software.com/support/topic/125142?replies=12#post-586322

    Let me know if that works (obviously, add SPAN tags to the way the links are displayed).

    I think I got lost, there’s something I don’t get it, I can partially understand the point of that post but with my limited knowledge in this field I can’t figure out what to do. :-\

    any thought?

    Instead of using wp-list-pages, use the following:

    <?php
    $querystr = "SELECT $wpdb->posts.* FROM $wpdb->posts WHERE $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_type = 'page' ORDER BY $wpdb->posts.post_title ASC";
    $pageposts = $wpdb->get_results($querystr, OBJECT);
    ?>
    <?php if ($pageposts): ?>
    <?php foreach ($pageposts as $post): ?>
    <?php setup_postdata($post); ?>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><span><?php the_title(); ?></span></a>
    
    <?php endforeach; ?>
    <?php else : ?>
    Not Found
    <?php endif; ?>

    Comment out the appropriate $these_pages line.

    All right; this bugged me because the solution I suggested didn’t work (at least, it didn’t on my 2.0.7 installation). So I found something else and it works:

    <?php
     function get_the_pa_ges (){
     global $wpdb;
    if ( ! $these_pages = wp_cache_get('these_pages', 'pages') ) {
    // For WP 2.1, 2.2
    //      $these_pages = $wpdb->get_results('select ID, post_title from '. $wpdb->posts .' where post_status = "publish" and post_type = "page" order by ID');
    
    //For wp 2.0.*
            $these_pages = $wpdb->get_results('select ID, post_title from '. $wpdb->posts .' where post_status = "static" order by ID');
    
             wp_cache_add('these_pages', $these_pages, 'pages');
       }
      return $these_pages;
     }
    
     function list_all_pages(){
    
    $all_pages = get_the_pa_ges ();
    foreach ($all_pages as $thats_all){
    $the_page_id = $thats_all->ID;
    $output .= '<li><a href="'.get_permalink($thats_all->ID).'" title="'.$thats_all->post_title.'"><span>'.$thats_all->post_title.'</span></a></li>';
    }
    
    return $output;
     }
    ?>
    <ul>
    <?php echo list_all_pages();?>
    </ul>

    I took this from here:
    https://www.tenterhooks.mbmontessori.com/archives/46

    The difference is that post_type in 2.0.7 is blank no matter what. And Pages are post_status=static. So I had to change things around a bit. Also, since the original code was in an effort to only include certain pages, I had to modify things a touch.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Horizontal menu, pages and css sliding door?’ is closed to new replies.