This is my first post here. I tried posting this in WP-Advanced but couldn’t so not knowing where else to post this…I came to this forum.
I am making changes to the index.php file inside the default theme (a copy of the theme actually) trying to quickly get up to speed on how to create my own themes.
So far so good but I got a question I am stumped on that I would appreciate input on.
The following code works just fine.
echo ‘Posted in ‘;
echo the_category(‘, ‘);
echo ‘ | ‘;
But for some strange reason that I can’t for the life of me figure out the following causes what the_category() returns to be echoed before ‘Posted in ‘ is.
echo ‘Posted in ‘.the_category(‘, ‘);
echo ‘ | ‘;
Why is that? Does the_category() not return just a string? If so…why does the above code (the second example) spit out a messed up result? Is WP doing some pre-execution interpretation of the PHP code?
Any input would be most appreciated.
PS. I appreciate the way WP tries to make things dummy proof but it’s frustrating trying to get around the dummy proofing and have things work as one might expect. A case in point being how WP uses backticks inside forum posts instead of the usual block BB code. I tried putting “code” in backticks and it just spits out the word “code” instead of puttign my code into a quote…sigh.
- The topic ‘Why does PHP call to the_category() do this?’ is closed to new replies.