sci-guy
sci-guy

Reputation: 2584

How to add font awesome into php code

I am working with the following php line of code

$author = apply_filters( 'display_posts_shortcode_author', ' <span class="author">| ' . get_the_author() . ' | Comments: ' . get_comments_number() . '</span>', $original_atts );

I am modifying a wordpress plugin and when called this line outputs the author and comment count of a post. I want to add the font awesome comment bubble (fa-comment "\f075") after the | Comments: part.

How can I do this?

FYI I am a complete noob with php.

Upvotes: 0

Views: 1766

Answers (2)

Neville
Neville

Reputation: 528

You can add it directly using its HTML codes.

Upvotes: 0

sol
sol

Reputation: 22949

The html for that icon is:

<i class="fa fa-comment" aria-hidden="true"></i>

You can add it to the php code you have like this:

$author = apply_filters( 'display_posts_shortcode_author', ' <span class="author">| ' . get_the_author() . ' | Comments: <i class="fa fa-comment" aria-hidden="true"></i>' . get_comments_number() . '</span>', $original_atts );

Upvotes: 1

Related Questions