WordPress.org

Support

Support » How-To and Troubleshooting » Query Posts by php the_title – How can I make this work?

Query Posts by php the_title – How can I make this work?

  • How can I make it so that I can query my posts by a tag that uses the title of a band name?

    Basically like this,

    tag = hootieandtheblowfish
    band name = Hootie And The Blowfish

    <?php query_posts($query_string . 'tag=<?php
    
    $band = '<?php the_title() ?>';
    $string = preg_replace('/\s+/', '', $band);
    
    echo $string
    
    ?>&posts_per_page=24'); ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    so I get I need to eliminate the white spaces, but can I search by a <?php> request like that or is there any way to do so?

    I think it may require some sort of double loop or something to get one variable and then apply it to the next, but I just don’t know. Case of the Mondays I guess….

    Hope this makes sense….

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Query Posts by php the_title – How can I make this work?’ is closed to new replies.
Skip to toolbar