Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #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
    -Nick

    #364450

    Hi 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!
    Ismael

    #364635

    Hi 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, 3 months ago by NLucano.
    #365124

    Hey!

    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!
    Ismael

    #365162
    This reply has been marked as private.
    #365211

    Hi!

    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!
    Ismael

    #365412
    This reply has been marked as private.
    #365770

    Hi!

    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!
    Ismael

    #365830
    This reply has been marked as private.
    #366669
    This reply has been marked as private.
    #367585

    Hi!

    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!
    Ismael

    #367619
    This reply has been marked as private.
    #367658

    Hey!

    Kriesi fixed something on the forum and it somehow break all forum subscriptions. Please let us know if you fixed the issue.

    Regards,
    Ismael

    #367891

    I 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?

    #368092

    Hi!

    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

Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.