Embedding code within “if” statements
-
I’ve been tweaking a few things within WordPress, slowly figuring out how everything works, and wanted to know something about if statements: is it possible to embed further php code within such a statement?
The situation I’m trying to create involves only displaying the Comments option under one specific post category. My guess(which does not work) as to how the code would be structured is something to this effect:
<?php if (in_category(‘5’))
{
?php comments_popup_link(__(‘Comments (0)’), __(‘Comments (1)’), __(‘Comments (%)’));
} else {
echo ”;
}?>Is it possible to place code within an if statement? Every tutorial that I’ve managed to find regarding “if” statements only uses commands like “echo,” so I haven’t been able to tell whether anything more complicated can be added. Any help would be appreciated.
- The topic ‘Embedding code within “if” statements’ is closed to new replies.