0

So I have this code: the_title() And I am trying to add some text before it. So, it would end up like this: PAGE TITLE: (page tile) => PAGE TITLE is what I am trying to add before my code. However, whenever I do that, the code pastes as plain text, like this: PAGE TITLE: the_title().

I tried using echo before everything, but it is not working! Help, please?

closed as off-topic by Michael, bosco, Jacob Peattie, Nathan Johnson, Christine Cooper Mar 6 '18 at 9:52

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

3

In order for the server to recognize and execute PHP code, the code must be enclosed within <?php ?> tags.

The first argument of the the_title() function is a string that will be output before the page title itself, so

<?php the_title('Page title: '); ?>

will print something like

Page title: Just Another Post
  • 1
    Please don't answer questions with additional questions :) . If you believe you have a solution, state it as such. If you need further clarification on the original issue, post a comment on the original question. Additionally, your answer is likely to receive more positive attention if you elaborate on it - especially when the solution isn't so intuitive as is the case here. Why does the code you posted accomplish the desired outcome? Please review the "How to Answer" page in our help center – bosco Mar 4 '18 at 23:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.