Forums

wp_pages_list dynamic link_befor? (4 posts)

  1. skullbooks
    Member
    Posted 2 years ago #

    hi

    i need some plugin/idea/hack to write dynamic content in the link_befor option of the wp_pages_list.

    in the end i'll have random integers befor my page-links in the sidebar for every pagelink a different one.
    for example:
    382 blog
    847 about
    482 imprint
    (the 849 can/should be compleatly random)

    is there any chance to do so without a core hack or manipulate the page after transmitting to the browser via js?

    thanks for every hind
    jan

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    This won't do any 'hierarchy' but:

    <?php
    //list pages with random number in front of each page title
        $args=array(
          'post_type' => 'page',
          'post_status' => 'publish',
          'showposts' => -1,
          'caller_get_posts'=> 1
          );
        $my_query = null;
        $my_query = new WP_Query($args);
        if( $my_query->have_posts() ) {
          echo 'List of Pages';
          while ($my_query->have_posts()) : $my_query->the_post(); ?>
          <p><?php echo rand(1, 999); ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
           <?php
          endwhile;
        }
    wp_reset_query();  // Restore global post data stomped by the_post().
    ?>
  3. skullbooks
    Member
    Posted 2 years ago #

    hey
    sorry, i'm very late.
    thx for the post. i understand what you mean but at the moment im not sure is i'll do all the stuff and write a compleat own menu.

    i'll first get the rest of the page started and then i maybe come back to the menu ;)

    cya
    jan

  4. skullbooks
    Member
    Posted 2 years ago #

    hey
    after some tests i have a new problem and/or questions.
    1. for what is the showpost = -1 and caller_get_post = 1?
    2. i'm trieing to write 2 widgets one for the top bar with only parent=0 posts. this is working fine but my sort_colum and the exclude does not work?

    my $args array looks like this in the code on the top.

    $args=array(
    		'post_type' => 'page',
    		'post_status' => 'publish',
    		'showposts' => -1,
    		'caller_get_posts'=> 1,
    
    		'post_parent' => 0,
    		'sort_column' => 'menu_order',
    		'sort_order' => 'ASC',
    		'exclude' => '53,51,49'
    	);

    would be nice if somebody can help me to understand whats realy happen there ;)

    thx

Topic Closed

This topic has been closed to new replies.

About this Topic