Notifications
Clear all

[Solved] I want to get the body of the post

8 Posts
3 Users
1 Reactions
924 Views
Posts: 6
Topic starter
(@gocchimama)
Active Member
Joined: 1 year ago

I can get the post title, username and post URL as below, but not the body.
Please give me advice on how to write it.

    $author_id = $post['userid']; 
    $author_name = get_the_author_meta('display_name', $author_id);

    $topic = wpforo_topic($post['topicid']);
    $topic_url = $topic['url'];

    $send_title = esc_html( $post['title'] );
7 Replies
Tutrix
Posts: 1455
(@tutrix)
Noble Member
Joined: 4 years ago

Hi @gocchimama

try

esc_html( wpforo_text( $post['body']) )

or

esc_html( wpforo_content_filter( $post['body']) )
Posts: 6
Topic starter
(@gocchimama)
Active Member
Joined: 1 year ago

Thank you !

i tried it ,but it didn't work...

2 Replies
Tutrix
(@tutrix)
Joined: 4 years ago

Noble Member
Posts: 1455

@gocchimama 

I am using the above codes for a mouseover post preview e.g. in the widgets and it works there.

BlackRaz
Admin
(@blackraz)
Joined: 8 years ago

Contributor
Posts: 406

@gocchimama 

Try this code for getting body

wpforo_content( $post, false );
Posts: 6
Topic starter
(@gocchimama)
Active Member
Joined: 1 year ago

Thank you !

But,I couldn't get it. When I look at the debug, the body does not exist in the array.

Array
(
[topicid] => 37
[forumid] => 2
[first_postid] => 42
[userid] => 1
[title] => this title
[slug] => %e3%81%95%e3%82%89%e3%81%ab%e3
[created] => 2023-07-2608:55:34
[modified] => 2023-07-2608:55:34
[last_post] => 42
[posts] => 1
[votes] => 0
[answers] => 0
[views] => 0
[meta_key] =>
[meta_desc] =>
[type] => 0
[solved] => 0
[closed] => 0
[has_attach] => 0
[private] => 0
[status] => 0
[name] =>
[email] =>
[prefix] =>
[tags] =>
[url] =>  http://forum.local/xxx 
[full_url] =>  http://forum.local/xxx 
[short_url] =>  http://forum.local/topicid/37/ 
)
 
How can I add the 'body' to the array?
BlackRaz
Posts: 406
Admin
(@blackraz)
Contributor
Joined: 8 years ago

@gocchimama
You can use this function e.g.

wpforo_topic( $post['topicid'], 'body' )
Page 1 / 2