Reply To: Custom-fields in Activity-content, error with function
With this code I have NO results:
function test1(){
global $post;
$test_customfield = get_post_meta($post->ID, 'txt_documento', true);
return $test_customfield;
}
//function test1( $the_post ) {
// $post_id = $the_post->ID;
//}
function record_post_activity_content($activity_content, $post, $post_permalink ){
if( $post->post_type == 'post' ) {
$not = var_dump( $test_customfield );
$activity_content = $not.'this yes';
}
return $activity_content;
}
add_filter( 'bp_blogs_activity_new_post_content', 'record_post_activity_content',1, 3 );
But I’ve tested this another code and the result is “NULL”:
add_action( 'genesis_post_content', 'custom_field_in_content' );
function custom_field_in_content() {
if ( in_category('documentos') ) {
$ay = var_dump( $test_customfield );
echo $ay;
}else {
}
}
I cant find the problem. Thanks for all your support