wordpress - Insert PHP within function -
wordpress - Insert PHP within function -
i have kid theme in wordpress , want insert code @ end of each single post:
<?php the_tags(); ?> i don't want edit single.php. insert code via functions.php
i found thread , used code in answer: https://wordpress.org/support/topic/insert-info-into-bottom-of-posts#post-3990037
it worked me, cannot figure out how insert php code.
these things tried didn't reflect wanted in front end end:
$content.= '<?php the_tags(); ?>'; $content.= ' the_tags();'; $content.= <?php the_tags(); ?>; $content.= the_tags(); how can alter code in wordpress thread include php?
thank you.
you're attempting concatenate output of the_tags onto $content, the_tags not homecoming anything. when phone call the_tags sends output browser itself.
the_tags pretty much wrapper around get_the_tag_list homecoming content string rather outputting it. try:
$content .= get_the_tag_list(); also, clarify wrong of attempts:
$content.= <?php the_tags(); ?>; <?php means begin interpreting php, @ point i'm assuming have opened php tags there no need 1 time again , attempting result in error.
$content.= ' the_tags();'; this append literal string the_tags(); onto $content. cannot embed function calls strings this.
$content.= '<?php the_tags(); ?>'; this lastly line combination of 2 issues mentioned. result in literal string <?php the_tags(); ?> beingness appended $content.
php wordpress
Comments
Post a Comment