-
AuthorPosts
-
November 9, 2021 at 12:43 pm #1328343
Changed the from topic: “Get published date instead of modified date on portfolio grid” into: “How to display date of publication in a portfolio grid”
Hi everybody,
I’m having troubles showing the correct date inside a portfolio grid. I found this piece of code somewhere on this forum:
add_filter('avf_portfolio_extra', 'avf_portfolio_extra_mod', 10, 2); function avf_portfolio_extra_mod($output, $entry) { $output = '<div class="portfolio-new-meta">'; $output .= "<time class='date-container minor-meta updated' $markup>".get_the_date( 'Y' )."</time>"; $output .= '</div>'; return $output; }
As you can see here: Portfolio grid with year of publication
the date is displayed, but it is the date of the page where I put the portfolio grid element for every entrybut it is the modified date, not the published date When I look in the mysql database, I can see the column “post_date” – this one I need – and I see the column “post_modified” – this one I don’t want :)Is there a little snippet I can add to my functions.php that will provide me with the published date
instead of modified date? I don’t mind if this changes will effect the whole site, I am not planning to use this modified date anywhere, it will be one big archive…Hope someone can help me out! Thanks from Utrecht / NL!
Bas
- This topic was modified 3 years, 1 month ago by Thisafternoon. Reason: I made a mistake in my question
November 10, 2021 at 10:43 am #1328457maybe I should rephrase my question a little bit…Where is the published date being replaced with the modified date for the portfolio items only and is there a way to revert this?For blog posts – using the blog post element in a grid for example, it does show the published date instead of the modified date. Why this difference for the Portfolio items?- This reply was modified 3 years, 1 month ago by Thisafternoon.
November 10, 2021 at 11:26 am #1328459Ahw excuse me… the little snippet in functions.php is not working at all… it just displays the date of the page where the portfolio grid is begin used over and over again.
It seems it has nothing at all to do with the modified date, my bad!
Anyway. Is there a little snippet I can add to functions.php that will get the published date for all the portfolio items in the loop and add it to all the grid entries?
November 13, 2021 at 7:32 pm #1328889Hi,
Thank you for your patience and sorry for the very late reply, please try this snippet instead:add_filter('avf_portfolio_extra', 'avf_portfolio_extra_mod', 10, 2); function avf_portfolio_extra_mod($output, $entry) { $output = '<div class="portfolio-new-meta">'; $output .= "<time class='date-container minor-meta updated' $markup>".get_the_modified_date( "Y-m-d", $entry )."</time>"; $output .= '</div>'; return $output; }
in my test this seems to be working
Best regards,
MikeNovember 16, 2021 at 11:21 am #1329190Perfect Mike,
Thank you so much! This is great for building an archive with Portfolio items.
All the best,
Bas
November 16, 2021 at 12:22 pm #1329201Hi,
Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.Best regards,
Mike -
AuthorPosts
- The topic ‘How to display date of publication in a portfolio grid’ is closed to new replies.