I am not part of support.. just some dude.
Thanks Camin, Angelo, and Marcus.. you guys are great.
I come here often to learn what others are trying to do and learn something new all the time.
@balders14
actually it does work.. well at least for me
But….
the link Camin provide appends the content to the bottom of information.. so you may have missed it down there. I did the first time I tried.
This code works for me at the bottom of the “content”
function new_default_content($content) {
global $post;
if ($post->post_type == event) {
$content .= 'Test text here';
}
return $content;
}
add_filter('the_content', 'new_default_content');
So digging a little further.. I looked up “prepend” and found information here..
https://wordpress.stackexchange.com/questions/39918/wordpress-hooks-filters-insert-before-content-or-after-title
So thusly… this added (prepended) the info…
function mycontent_stuff_filter_the_content( $content )
{
global $post;
if ($post->post_type == event)
$custom_content = 'YOUR CONTENT GOES HERE';
$custom_content .= $content;
return $custom_content;
}
add_filter( 'the_content', 'mycontent_stuff_filter_the_content' );
Now my code “may” be wrong but I am not getting any errors.
Add to your themes function.php file… or your child theme’s function.php.
As alway backup your functions.php before making any changes.
I find using FTP best for this as you can quickly upload your backup if you make mistakes and an error pops up.