• Resolved insidebigbro

    (@insidebigbro)


    I am trying to do something quite complicated. I’d love it if someone could help me code a solution!

    <?php $my_query = new WP_Query('tag=XXX&amp;showposts=10');
      while ($my_query->have_posts()) : $my_query->the_post();
      ?>
    
    STUFF HERE  	
    
    <?php endwhile; ?>

    Basically, i’d like the XXX bit to automatically be echoed as the NAME of the current Page. I’m implementing this code in a page template, so for example if the page name was “Martin” it would echo

    <?php $my_query = new WP_Query('tag=Martin&amp;showposts=10');
      while ($my_query->have_posts()) : $my_query->the_post();
      ?>
    
    STUFF HERE  	
    
    <?php endwhile; ?>

    Any help GREATLY appreciated!

Viewing 2 replies - 1 through 2 (of 2 total)
  • <?php
    $args = array(
      'tag' => $post->post_title,
      'showposts' => 10
      );
    $my_query = new WP_Query($args);
    while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
    <?php
    endwhile;
    ?>
    Thread Starter insidebigbro

    (@insidebigbro)

    You are a GOD!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Help with hacking wp_query! Help GREATLY appreciated!’ is closed to new replies.