-
AuthorPosts
-
December 7, 2014 at 6:32 am #364242
Hi there,
I have a website which i use with this Enfold theme and the focus of the website is job listings.
I was wondering if there was a way that when I make a new posting (which are jobs obviously) I could somehow create a little box next to each title that says “NEW” and have it stay there for an extended period of time, say a week after i posted it.
Or even if it only showed “NEW” to a returning visitor who has not seen that particular job yet since his last visit.
I have googled a solution to this, but it did not work for me, so I was hoping maybe you guys could help me out with this.
Still loving the theme by the way!Thank you in advance
-NickDecember 8, 2014 at 6:19 am #364450Hi NLucano!
Thank you for using Enfold.
You can edit loop-index.php, find this line:
echo $title;
Below, you can add this:
$publisheddate = get_the_time('Y-m-d'); $published = strtotime($publisheddate); $expiration = $published + (7 * 24 * 60 * 60); $today = current_time('timestamp'); if($expiration > $today) { echo "NEW"; } else { echo "OLD"; }
The post will expire in 7 days.
Cheers!
IsmaelDecember 8, 2014 at 2:58 pm #364635Hi Ismael,
Thank you, however, I actually do NOT want the post to expire in 7 days as all the jobs expire in different days.
I just want all of the new postings that I post from here on out to actually show the word “NEW” next to the title (maybe in a little box or smaller font ) so returning and incoming visitors KNOW which jobs I have posted recently or which jobs are new since they have last visited. And then have that word NEW expire after a certain period of time or after they read the posting, i do not want the entire posting to expire.
Hope that makes sense.
-Nick
- This reply was modified 9 years, 11 months ago by NLucano.
December 9, 2014 at 3:45 am #365124Hey!
Yeah. It will not actually expire or remove the post. It will only put the word “NEW” below the title for new posts. The text will be removed after 7 days. You can style it with css. Please try it. You can replace the code with this, if you don’t want to add the text “OLD” for old posts:
$publisheddate = get_the_time('Y-m-d'); $published = strtotime($publisheddate); $expiration = $published + (7 * 24 * 60 * 60); $today = current_time('timestamp'); if($expiration > $today) { echo "<span class='new-post-meta'>NEW</span>"; }
Use .new-post-meta class on the Quick CSS field to move the text.
.new-post-meta { position: relative; padding: 3px; background: green; color: white; }
If you’re looking for something else, I don’t think we can help you further. Please hire a freelance developer to add the feature for you or find a plugin that works with the theme. For further modifications, please visit Envato Studio or Werkpress.
Cheers!
IsmaelDecember 9, 2014 at 5:23 am #365162This reply has been marked as private.December 9, 2014 at 7:38 am #365211Hi!
Looks like you’re using the grid layout. You can edit config-templatebuilder > avia-shortcodes > postslider.php. Look for this code:
$output .= !empty($title) ? "<h3 class='slide-entry-title entry-title' $markup><a href='{$link}' title='".esc_attr(strip_tags($title))."'>".$title."</a></h3>" : '';
For further modifications, please visit Envato Studio or Werkpress.
Cheers!
IsmaelDecember 9, 2014 at 4:38 pm #365412This reply has been marked as private.December 10, 2014 at 2:01 am #365770Hi!
Please look for this code:
$output .= !empty($title) ? "<h3 class='slide-entry-title entry-title' $markup><a href='{$link}' title='".esc_attr(strip_tags($title))."'>".$title."</a></h3>" : '';
Replace it with:
$output .= !empty($title) ? "<h3 class='slide-entry-title entry-title' $markup><a href='{$link}' title='".esc_attr(strip_tags($title))."'>".$title."</a></h3>" : ''; $publisheddate = get_the_time('Y-m-d'); $published = strtotime($publisheddate); $expiration = $published + (7 * 24 * 60 * 60); $today = current_time('timestamp'); if($expiration > $today) { $output .= "<span class='new-post-meta'>NEW</span>"; }
Cheers!
IsmaelDecember 10, 2014 at 4:15 am #365830This reply has been marked as private.December 11, 2014 at 3:05 pm #366669This reply has been marked as private.December 13, 2014 at 1:18 am #367585Hi!
Sorry for the delay. I tested this on my installation and it works fine with the second blog posts’ offset activated. Note that the text will expire after 7 days of the posts published date. For further modifications, please visit Envato Studio or Werkpress.
Cheers!
IsmaelDecember 13, 2014 at 4:35 am #367619This reply has been marked as private.December 13, 2014 at 12:29 pm #367658Hey!
Kriesi fixed something on the forum and it somehow break all forum subscriptions. Please let us know if you fixed the issue.
Regards,
IsmaelDecember 14, 2014 at 5:04 am #367891I have figured out the issue although it is a bit bizarre. After playing around with the setting of the offset I tried different combinations and I found out the problem is this:
[av_blog blog_type='posts' categories='88' link='category' blog_style='blog-grid' columns='1' contents='excerpt_read_more' content_length='content' preview_mode='auto' image_size='portfolio' items='14' offset='no_duplicates' paginate='no']
Where it says “items” I had it set to 50 because i had 50 jobs for that area so I was hoping to show 50 jobs with no paginate because i wanted them all on one page. Well I have it set to 14 now, and any time i put in any number over 14, the “new” goes away for every post in the offset. 14 and under for the items and the “new” shows up properly, but then of course it cuts off the rest of my jobs from being loaded on the page.
Any idea on how I can fix that? Is it a bug?
December 15, 2014 at 2:09 am #368092Hi!
I’m sorry but I don’t have that many posts on my installation to test this with. Aside from the custom script that we gave you in order to show “NEW” text for new posts, I’m afraid we won’t be able to help you to debug the issue. Please hire a freelance developer or visit Envato Studio or Werkpress for further investigation.
Cheers!
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.