Support » Fixing WordPress » How can I call a function into another function?

  • How can I call a function into another function?


    show only post with tag one…but if tag is a variable?

    How insert <?php single_tag_title(); ?> instead of one ???

    If try:

    query_posts(‘tag=<?php single_tag_title(); ?>’);

    I’ve get an error..
    How can I resolved it?


Viewing 4 replies - 1 through 4 (of 4 total)
  • An argument can’t be a function, but it can be a variable. I’m not exactly sure what you’re trying to do, but if you can store the return value of one function as a variable, and then use that in your parameters.
    I don’t know if this would be a solution for you or not, just based on the one line of code.

    Well that’s not exactly true, an argument can be a function, but not the way you’re doing it.
    Why do you have an extra <?php and ?>… does query_posts() step out of PHP?

    I’ve many post with tags..
    In sidebar, into archive page, I would insert this code:


    Works correctly…show only post with tags iphone and video..but if I would change “iphone” with current tags I’ve many problems…


    query_posts(‘tag=<?php single_tag_title(); ?> +video&showpost=10’);

    ok, so how do you place the variable in the function?

    i have converted the argument into a variable:
    <?php $current_tag = single_tag_title("", false); ?>
    <?php single_tag_title(); ?>
    am i right?

    now how can i add that variable to this function (replacing the tag “coldplay” with “$current_tag”)

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

    how is the final code?
    please help me thanks! i have been hours trying to solve it

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How can I call a function into another function?’ is closed to new replies.