Simple php snippet help: Wordpress

supermex

Elite Member
Joined
Nov 19, 2016
Messages
1,825
Reaction score
658
Hey,

I'd like to add some text content at the end of every wordpress blog post of a specific post category. Here's my idea but it doesn't really work:

Added in functions.php

if ( is_category( 'category1' ) ) {
function add_my_text() {
echo '<p>This is my extra text.</p>';
}
add_action( 'after_main_content', 'add_my_text' );
}

I think the red part is wrong. I possibly need a hook there?
 
Back
Top