Notifications
Clear all

[Solved] Remove the post creation date from the RecentPost widget

25 Posts
5 Users
4 Likes
4,123 Views
Posts: 530
Topic starter
(@central4allgmail-com)
Prominent Member
Joined: 6 years ago

How to remove the post creation date from the RecentTopics widget?
I found this code in the RecentTopics.php file:
esc_html( wpforo_date( $topic['created'], 'ago', false ) ) (line 94)
But removing it breaks the website

https://prnt.sc/qClJSzSrEcd-

24 Replies
Robert
Posts: 10503
Admin
(@robert)
Support Team
Joined: 8 years ago

@central4allgmail-com,

You should never make changes in the core files. This can be done by a small JS script:

jQuery('#wpf-widget-recent-replies .postuser').html(function(_,h){
    return h.replace(/\,.+?$/g,'');
});

 

If you don't have a place for a JS code, then you should put it directly in the footer.php of your WordPress active theme with <script> ... </script> wrapper:

<script>
   jQuery('#wpf-widget-recent-replies .postuser').html(function(_,h){
	return h.replace(/\,.+?$/g,'');
   });
</script>

 

 

 

Posts: 530
Topic starter
(@central4allgmail-com)
Prominent Member
Joined: 6 years ago

is not working after the last update,

https://prnt.sc/Et1VlD5fCVtO

i want to hide the date, the "from" and the comments of the post not to be visible

2 Replies
(@central4allgmail-com)
Joined: 6 years ago

Prominent Member
Posts: 530

any help?

Robert
Admin
(@robert)
Joined: 8 years ago

Support Team
Posts: 10503

@central4allgmail-com,

The code works fine, so there is no any change. You should use the same code.

I think you've got new JS errors which stop all JS functions. Also, you may damage the code, or it has been minified incorrectly by some optimizer plugin. So just find the problem what stops the code. Keep in mind that the code works correctly. You can test it on other WordPress/wpForo sites. We've done the same test today as well.

 

Robert
Posts: 10503
Admin
(@robert)
Support Team
Joined: 8 years ago

hmm... I just checked your site, and it works fine, you're reporting not-existing issues.

2 Replies
(@central4allgmail-com)
Joined: 6 years ago

Prominent Member
Posts: 530

@robert So you dont see the post text?

you dont see the "from"

 

what is all this white ?

(@central4allgmail-com)
Joined: 6 years ago

Prominent Member
Posts: 530

@robert

These are the changes I was making to the RecentPosts widget:

delete

<p class="posttext"><?php echo esc_html( wpforo_text( $post['body'], $instance['excerpt_length'] ) ); ?></p>

delete

, <?php esc_html( wpforo_date( $post['created'] ) ) ?>

To remove what I didn't want from it. The first line could not be found on the latest version of wpforo but I found this line:

<p class="posttext"><?php echo esc_html( wpforo_text( $post['body'], $instance['excerpt_length'], false ) ); ?></p>

and removing it had the effect I wanted.The second line was the same in the latest version and I removed it without issues.

Can I achieve the same with js code so I don't have to delete those line from the foro code?

Robert
Posts: 10503
Admin
(@robert)
Support Team
Joined: 8 years ago

@central4allgmail-com,

The code was provided to hide the post date. And it does it right now. I cannot understand what else you're looking for. The code was only written to hide the post data from the widget. It does its job very well.

2 Replies
(@central4allgmail-com)
Joined: 6 years ago

Prominent Member
Posts: 530

@robert 

Ι want to remove the exerpt as well as the "by" (από in the forum) before each name. Basically all the white text of the RecentPost and RecentTopic widgets

I've been doing this by editing the RecentPosts and RecentTopics widgets (and putting the changes every time there is a foro update). It was working, although it was a bit of trouble making all the changes after every update.

Since wpforo 2.0 this is no longer possible. I managed to remove all I wanted to remove in the previous version, except for the date, which is why I made a post here to ask for the code to remove it.

But in the latest version it doesn't appear like anything is removed now when I edit the code, except for the date. So now I'm looking on how to remove everything I was able to in the past.

(@central4allgmail-com)
Joined: 6 years ago

Prominent Member
Posts: 530

All changes were made by editing wpforo files. If it's possible in future versions to give users more options on what those two Widgets can show! Until then I guess I'll be making edits to core files to make it look like I want.

Page 1 / 2