• i want that my blog does the following.
    When the user is at
    myblog.com/tag/coldplay

    display the next article:
    myblog.com/wp-content/themes/mytheme/articles/colplay.php at the top of the posts.

    now i have done this succesfully. i inserted this code in the archive.php

    <?php
    echo '	';
    if ( is_tag(coldplay) ) {
     ' &raquo;  '; include(TEMPLATEPATH . '/articles/coldplay.php');
    }
    echo '
    ';
    ?>

    but i want with the help of php, and $posttag save me some work since i have a lot of tags with lots of articles. (the article name is the same as the tag) but i dont know how to insert the tag in the “include” path.

    can you help me? it´s the only thing that i need to run my theme smoothly. with what code should i replace the /articles/coldplay.php??

    i was thinking in using

    <?php
    echo '	';
    if ( is_tag($posttag) ) {
     ' &raquo;  '; include(TEMPLATEPATH . '/articles/$posttag.php');
    }
    echo '
    ';
    ?>

    but it didn´t work. hope you can understand me. how can i get the tag name and assign it the value of $posttag?
    thanks for your help!

Viewing 1 replies (of 1 total)
  • Thread Starter diego018

    (@diego018)

    update:
    i have found this:

    <?php $current_tag = single_tag_title("", false); ?>

    this gets the title of the tag. how can i add it to

    include(TEMPLATEPATH . '/articles/coldplay.php');

    and

    if ( is_tag(coldplay) ) {

    replacing coldplay??

Viewing 1 replies (of 1 total)
  • The topic ‘Help me inserting the $posttag in a php include function!’ is closed to new replies.