#1 WordPress forum plugin created by gVectors Team

wpForo – WordPress Forum Plugin
  • Home
  • Forum
  • Migrate to wpForo
  • Addons
  • Documentation

Forum

Home | Forum

wpDiscuz - WordPress Comment Plugin
  • Forums
  • Members
  • Recent Posts
Forums
Main Support Forums
How-to and Troubles...
Add "NEW" to fresh ...
 
Share:
Notifications
Clear all

Add "NEW" to fresh content, and an excerpt in threaded posts

Page 1 / 2 Next
    Last Post
RSS

mcutting
Posts: 393
mcutting - Twitter
 mcutting
Topic starter
April 18, 2019 11:46 am
(@mcutting)
Reputable Member
Joined: 4 years ago

I know someone on here asked about adding a "Fresh" or "New" icon when a new post is added - so I've done exactly that as I think it enhances the user experience. Additionally, I've added an excerpt with "Read More" under the topic thread title.

Have a look here - https://inocul8r.net and let me know if you'd like the code changes (it requires templates - please don't modify the core as your changes will over overwritten on the next update)

 

in.png

I founded the Phenomlab technology and information security community in order to help anyone at any level understand how they can get the most out of technology, learn how it works, and better still, make the most out of security. Why not take a look ?
CISO / CIO in the finance sector, developer, technology enthusiast, and open source evangelist

Topic Tags
customization new fresh excerpt
7 Replies
CENTRAL4ALL
Posts: 409
 CENTRAL4ALL
April 19, 2019 12:59 pm
(@central4allgmail-com)
Reputable Member
Joined: 2 years ago

This looks like a great feature if you can share the code

All Suggestions are welcome
https://adultforum.gr/

Reply
CENTRAL4ALL
Posts: 409
 CENTRAL4ALL
April 25, 2019 11:51 am
(@central4allgmail-com)
Reputable Member
Joined: 2 years ago
@mcutting is there a problem with the code to share with us?

All Suggestions are welcome
https://adultforum.gr/

Reply
mcutting
Posts: 393
mcutting - Twitter
 mcutting
Topic starter
April 25, 2019 3:36 pm
(@mcutting)
Reputable Member
Joined: 4 years ago

@central4allgmail-com sorry - been busy. Here's the code, plus where it goes

Note, that this assumes you have the threaded layout, as that's what my entire forum is structured with. You should also have custom templates ready, otherwise, your changes will be overwritten on each update. Based on this, I'm assuming you have templates already located inside a "wpforo" directory in your theme's folder

Take a backup of all files before you modify them 🙂

1. Edit file /wpforo/layouts/4/forum-thread.php. Place the below code around line 7

$range = date('Y-m-d',strtotime("-3 days")); 

2. Find the DIV block <div class="wpf-thread-box wpf-thread-date"> which should be around line 34, and replace with the below

 <div class="wpf-thread-box wpf-thread-date">
<?php if($thread['created'] > $range) {$newpost = "<br><div class='newpost'>NEW</div>";} else {$newpost = "";} ?>
<?php echo $thread['last_post_date'] . $newpost ?>
</div>

3. Save the file

4. Save the below block of custom CSS either inside the wpForo settings, or within your own theme

.newpost {
background: #28b62c !important;
padding: 3px !important;
padding-left: 10px !important;
padding-right: 10px !important;
color: #ffffff !important;
font-size: 0.6rem !important;
font-weight: 700 !important;
margin-left: 10px !important;
border-radius: 0.2rem !important;
margin-top: 5px !important;
width: 50%;
display: inline-block;
}

Note that you'll need to tailor this to suit - don't forget that my templates are heavily customised. I'm also having to use !important to override some classes. This probably won't be necessary in your theme.

5. Modify /wpforo/layouts/4/topic-thread.php in the same manner. Place the below code around line 7 of topic-thread.php

$range = date('Y-m-d',strtotime("-3 days")); 

6. Find the DIV block <div class="wpf-thread-box wpf-thread-date"> which should be around line 30, and replace with the below

 <div class="wpf-thread-box wpf-thread-date">
<?php if($thread['created'] > $range) {$newpost = "<br><div class='newpost'>NEW</div>";} else {$newpost = "";} ?>
<?php echo $thread['last_post_date'] . $newpost ?>
</div>

7. Save the file

8. Clear caches, and review. Hopefully, all went well, and things look like they should. 

 

 

 

I founded the Phenomlab technology and information security community in order to help anyone at any level understand how they can get the most out of technology, learn how it works, and better still, make the most out of security. Why not take a look ?
CISO / CIO in the finance sector, developer, technology enthusiast, and open source evangelist

Reply
CENTRAL4ALL liked
mcutting
Posts: 393
mcutting - Twitter
 mcutting
Topic starter
April 25, 2019 3:40 pm
(@mcutting)
Reputable Member
Joined: 4 years ago

Also, if you're looking for the "excerpt in threaded posts", this can be found here

I founded the Phenomlab technology and information security community in order to help anyone at any level understand how they can get the most out of technology, learn how it works, and better still, make the most out of security. Why not take a look ?
CISO / CIO in the finance sector, developer, technology enthusiast, and open source evangelist

Reply
Page 1 / 2 Next
  All forum topics
  Previous Topic
Next Topic  
Related Topics
  • Class/ID by forum
    9 months ago
  • Customizing CSS file
    9 months ago
  • How do i stop this?
    11 months ago
  • Sort topics by its created time, not the last reply's created time
    1 year ago
  • How to change the post layout like in this forum?
    1 year ago
Topic Tags:  customization (18), new (1), fresh (1), excerpt (1),

Forum Search

Join Us!

Download wpForo plugin
on WordPress.org

wpForo Addons

wpforo-private-messages  wpforo-advanced-attachments-128x128  wpforo-embeds-128x128 wpForo User Custom Fields addon  wpForo – Blog Cross Posting addon  wpForo Ads Manager
View all Addons »

Recent Topics

  • Like button doesn't work- anyone else with the same issue?

    By dinak, 1 hour ago

  • Like button on forums not working

    By dinak, 2 hours ago

  • Being Spammed by Fake members

    By Percysgrowroom, 3 hours ago

  • Add topic button in forum description

    By VereK, 11 hours ago

  • DB Errors in logs

    By VereK, 12 hours ago

  • How do I extend these for mobile view??

    By dantesalvino, 15 hours ago

Topic Tags

  • new features43
  • seo40
  • translation37
  • plugin conflict36
  • forum36
  • buddypress33
  • login33
  • registration30
  • threaded layout30
  • ultimate member29
  • moderation28
  • editor25
  • css25
  • avatar24
  • menu24
  • shortcode24
  • tags22
  • profile22
  • migration20
  • url20
View all tags (1516)

Recent Posts

  • Like button doesn't work- anyone else with the same issue?

    In my settings, I have every member role except guest t...

    By dinak, 1 hour ago

  • RE: Being Spammed by Fake members

    ok, so in previous (related) topic you said you found t...

    By dimalifragis, 1 hour ago

  • Like button on forums not working

    In my settings, I have every member role except guest t...

    By dinak, 2 hours ago

  • RE: How to atract visitors or make people interact with the forum? // POSSIBLE ERROR?

    It is great to see that some people still put in an eff...

    By Harrelson1, 10 hours ago

  • Add topic button in forum description

    As per the title. Is there a way to add an "Add topic" ...

    By VereK, 11 hours ago

  • DB Errors in logs

    Hundreds of these in the logs WordPress database erro...

    By VereK, 12 hours ago

  • How do I extend these for mobile view??

    How do I extend these boxes on mobile view? It doesn't ...

    By dantesalvino, 15 hours ago

Share:
  Forum Statistics
20 Forums
8,041 Topics
40.3 K Posts
9 Online
15.5 K Members

Latest Post: Like button doesn't work- anyone else with the same issue? Our newest member: Online Roll UA Recent Posts Unread Posts Tags

Forum Icons: Forum contains no unread posts Forum contains unread posts

Topic Icons: Not Replied Replied Active Hot Sticky Unapproved Solved Private Closed

Powered by wpForo | Copyright © 2016-2021 gVectors Team
Copyright Registration Service - Click here for more information or to register work
wpForo is Registered with the IP Rights Office
Copyright Registration Service

Ref: 4477265538
  • Home
  • Forum
  • Migrate to wpForo
  • Addons
  • Documentation