Support » Fixing WordPress » help to solve echo php Incorrect concatenation

  • Resolved nair



    yesterday in this forum you guys helped me to solve this problem: topic 157771

    and today i thought that i could solve this:

    } elseif ( (in_category('56')) {
    echo 	'<div id="submenu">
                <ul class="fix">
    wp_list_cats(' . optioncount=0&child_of=56&orderby=ID . ')

    someone can helpe one more time?


Viewing 3 replies - 1 through 3 (of 3 total)
  • Might I suggest this:

    easy php tutorial for WP users

    wp_list_cats() is PHP, not HTML. You need to break out of the apostrophes to switch from a string (HTML) to a PHP command and then back to a string.

    In general:

    echo 'html html html' . php . 'html html html';

    In specific:

    echo '<div>...<ul>...' . wp_list_cats('query') .'...</ul></div>';

    You are concatenating (connecting) a string <div>...<ul>... to a PHP command wp_list_cats() to another string ...</ul></div>.

    Maybe it would be more obvious what’s going on if I wrote your code like this:

    } elseif ( (in_category('56')) {
    echo 	'<div id="submenu">
                <ul class="fix">';
    echo '      </ul>

    That’s a neat little tutorial, Adam!
    Bookmarked 🙂

    thanks a lot adamrbrown for all this great information for me to study!

    it works, problem solved 🙂

    thanks again!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘help to solve echo php Incorrect concatenation’ is closed to new replies.