I am using a child theme and try to get some code show up after the content on single post/pages
function app_bits() {
global $post;
$app_logo = get_post_meta($post->ID, 'AppLogo', TRUE);
$zund_id = get_post_meta($post->ID, 'AppURL', TRUE);
if ( is_single() || is_page() ) {
?>
<div class="hidemobile">
<div class="one_half">
<!-- ad code -->
sample
</div>
<div class="one_half column-last">
<?php
if ($zund_id !='') {
?>
<div style="text-align: center;">custom code goes here
</div>
<?php } else { ?>
<div style="text-align: center;">custom code goes here
</div>
<?php } ?>
</div>
</div>
<?php
}
}
add_filter( 'the_content', 'app_bits');
The issue is it replaces the content. Is there a after_the_content
hook I can use so that the content I want goes after the content?
After reading what @toscho said that I came up with this ( I am not some one who uses PHP , which should become obvious after looking at the code below -_- ) if anyone esle is looking for the same , here is what I used
function app_bits($content) {
global $post;
$app_logo = get_post_meta($post->ID, 'AppLogo', TRUE);
$zund_id = get_post_meta($post->ID, 'AppURL', TRUE);
if ( !is_singular() )
{
return $content;
}
$custom_bits1='<div class="hidemobile">
<div class="one_half">
<!-- ad code -->
sample here
</div>
<div class="one_half column-last">';
$custom_bits2='<div style="text-align: center;">custom code goes here
</div></div></div>';
$custom_bits3='<div style="text-align: center;">custom code goes here
</div></div></div>';
if ($zund_id !='') {
return $content . $custom_bits1. $custom_bits2;
} else {
return $content . $custom_bits1. $custom_bits3;
}
}
add_filter( 'the_content', 'app_bits');