- This topic has 38 replies, 4 voices, and was last updated 4 years, 12 months ago by
Elvin.
-
AuthorPosts
-
June 2, 2021 at 9:39 pm #1808162
Rob
Thanks, this is what it looks like now:

But I still want to display the original date of publication. Is there some CSS I can use for that?
Thanks.
June 2, 2021 at 11:00 pm #1808218Elvin
StaffCustomer SupportBut I still want to display the original date of publication. Is there some CSS I can use for that?
Can we lay down all the scenarios?
Let’s clarify a bit:
I believe what you’re aiming for is, to display the last update date AND publish date at the same time?
If this is the case, let’s review any filters used.
If you’ve used this filter –
add_filter( 'generate_post_date_show_updated_only', '__return_true' );– it will only show one date. It’s either it displays the publish date or the modified/update date if it exists.If you’ve used this filter –
generate_post_date_output– to modify the date output, you can remove that as well. There’s no need to filter anything if you simply want to display both dates at the same time. The theme automatically outputs both dates. It just hides the update date by default using CSS.If you want to display both dates at the same time, remove the mentioned filters and simply go the CSS route.
Example: – https://generatepress.com/forums/topic/publish-date-and-modified-date-on-a-post/#post-1181495And here – https://generatepress.com/forums/topic/how-to-show-published-and-updated-dates/#post-1466990 – where David mentioned that the theme automatically outputs both dates and provides the CSS to show both.
June 2, 2021 at 11:38 pm #1808257Rob
Thanks, what I’m trying to achieve is to have both the original published date (the date the post was first published) and the ‘last updated’ date displayed.
Regarding the filters you mentioned, I don’t think I have them.
This is my added CSS now:

Since beginning this thread earlier today I have uploaded a child theme for my GP installation. So the previous CSS that I had is now in the ‘parent’ theme.
Thanks for your help.
June 3, 2021 at 8:01 pm #1809502Elvin
StaffCustomer SupportRegarding the filters you mentioned, I don’t think I have them.
Can you link me to a sample page in question to confirm?
I’m not sure I’m seeing the right one because I still see this – https://share.getcloudapp.com/yAuroRLK
This is clearly different from what you’ve shown here – https://generatepress.com/forums/topic/the-date-is-being-duplicated-on-my-blog-posts/page/2/#post-1808162
June 4, 2021 at 5:12 pm #1810795Rob
I’m seeing different meta data at the top of that blog post (to what was shown in your screenshot):
https://share.getcloudapp.com/kpuDd8EPscreenshot
Here is a link to the page, as you requested: sample page
Thanks for your help with this.
June 4, 2021 at 5:32 pm #1810804Rob
Just to clarify: all I’m trying to do now is add the original date of publication, so that at the top of each article I have (a) the original date of publication, (b) the last updated date.
I have (b) so all I need now is (a).
Thanks again for your help! 🙂
June 5, 2021 at 8:45 pm #1811845Tom
Lead DeveloperLead DeveloperHi there,
Just read through this to try to get a grasp on what could be happening.
By default, GeneratePress will output the HTML for the published date and the updated date, so really we’d only need a little bit of CSS.
However, you’re not using the default HTML, you’ve hooked in the modified date manually. Any reason for this vs. using the core theme structure? I tried to find the answer in the topic but might have missed it.
We can always provide some PHP to add the published date, but I think using the core theme solution is likely the better route if we can.
Let us know 🙂
June 6, 2021 at 5:28 am #1812114Rob
Thanks.
I’m happy to remove the ‘modified date’ hook and just use CSS instead (if that’s the solution).
Should I go ahead and delete this element?

Thanks for your help.
June 6, 2021 at 4:12 pm #1812700Elvin
StaffCustomer SupportThanks.
I’m happy to remove the ‘modified date’ hook and just use CSS instead (if that’s the solution).
Should I go ahead and delete this element?
Yes that’s actually what I’ve been suggesting from my previous replies – https://generatepress.com/forums/topic/the-date-is-being-duplicated-on-my-blog-posts/#post-1808098
You don’t have to hook in a new date if the theme’s default is enough. We can just filter it or add the labels on CSS which I’ve also suggested here – https://generatepress.com/forums/topic/the-date-is-being-duplicated-on-my-blog-posts/#post-1808158
June 8, 2021 at 3:50 pm #1815479Rob
Thanks for that. I’ve now deleted that hook:

This is what the article meta data looks like now:

The article meta data is missing the original publication date. Do you have some CSS script I can use to add the date of first publication?
Thanks.
June 8, 2021 at 6:53 pm #1815555Elvin
StaffCustomer SupportSorry for asking again but can you check for any filters related to the post date?
I’ve inspected your site and it seems to be filtered.
An unfiltered, default render of post date meta would look like this –
https://share.getcloudapp.com/jkuPKjJlBut your site doesn’t render the published date as shown here –
https://share.getcloudapp.com/BluKBmEZThis normally occurs when a site has this filter on – https://docs.generatepress.com/article/generate_post_date_show_updated_only/
June 8, 2021 at 7:15 pm #1815569Rob
There might be filters in the added-on CSS in the parent theme. But I can’t access the parent theme now because I’m using a child theme.
This is the sum total of the added CSS in my child theme:

Thanks for your help.
June 8, 2021 at 8:15 pm #1815603Elvin
StaffCustomer SupportThere might be filters in the added-on CSS in the parent theme. But I can’t access the parent theme now because I’m using a child theme.
It’s a PHP filter so it won’t be on the additional CSS area.
PHP snippets are usually placed on Hook elements, Code Snippets plugins or a functions.php of a parent theme or a child theme. These are the places you must check. 🙂
June 8, 2021 at 9:13 pm #1815626Rob
This is the code in the functions.php file from the parent theme.
I can’t see the filter that you refer to:
<?php
/**
* GeneratePress.
*
* Please do not make any edits to this file. All edits should be done in a child theme.
*
* @package GeneratePress
*/if ( ! defined( ‘ABSPATH’ ) ) {
exit; // Exit if accessed directly.
}// Set our theme version.
define( ‘GENERATE_VERSION’, ‘3.0.3’ );if ( ! function_exists( ‘generate_setup’ ) ) {
add_action( ‘after_setup_theme’, ‘generate_setup’ );
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* @since 0.1
*/
function generate_setup() {
// Make theme available for translation.
load_theme_textdomain( ‘generatepress’ );// Add theme support for various features.
add_theme_support( ‘automatic-feed-links’ );
add_theme_support( ‘post-thumbnails’ );
add_theme_support( ‘post-formats’, array( ‘aside’, ‘image’, ‘video’, ‘quote’, ‘link’, ‘status’ ) );
add_theme_support( ‘woocommerce’ );
add_theme_support( ‘title-tag’ );
add_theme_support( ‘html5’, array( ‘search-form’, ‘comment-form’, ‘comment-list’, ‘gallery’, ‘caption’, ‘script’, ‘style’ ) );
add_theme_support( ‘customize-selective-refresh-widgets’ );
add_theme_support( ‘align-wide’ );
add_theme_support( ‘responsive-embeds’ );add_theme_support(
‘custom-logo’,
array(
‘height’ => 70,
‘width’ => 350,
‘flex-height’ => true,
‘flex-width’ => true,
)
);// Register primary menu.
register_nav_menus(
array(
‘primary’ => __( ‘Primary Menu’, ‘generatepress’ ),
)
);/**
* Set the content width to something large
* We set a more accurate width in generate_smart_content_width()
*/
global $content_width;
if ( ! isset( $content_width ) ) {
$content_width = 1200; /* pixels */
}// This theme styles the visual editor to resemble the theme style.
add_editor_style( ‘assets/css/admin/editor-style.css’ );
}
}/**
* Get all necessary theme files
*/
$theme_dir = get_template_directory();require $theme_dir . ‘/inc/theme-functions.php’;
require $theme_dir . ‘/inc/defaults.php’;
require $theme_dir . ‘/inc/class-css.php’;
require $theme_dir . ‘/inc/css-output.php’;
require $theme_dir . ‘/inc/general.php’;
require $theme_dir . ‘/inc/customizer.php’;
require $theme_dir . ‘/inc/markup.php’;
require $theme_dir . ‘/inc/typography.php’;
require $theme_dir . ‘/inc/plugin-compat.php’;
require $theme_dir . ‘/inc/block-editor.php’;
require $theme_dir . ‘/inc/class-theme-update.php’;
require $theme_dir . ‘/inc/deprecated.php’;if ( is_admin() ) {
require $theme_dir . ‘/inc/meta-box.php’;
require $theme_dir . ‘/inc/dashboard.php’;
}/**
* Load our theme structure
*/
require $theme_dir . ‘/inc/structure/archives.php’;
require $theme_dir . ‘/inc/structure/comments.php’;
require $theme_dir . ‘/inc/structure/featured-images.php’;
require $theme_dir . ‘/inc/structure/footer.php’;
require $theme_dir . ‘/inc/structure/header.php’;
require $theme_dir . ‘/inc/structure/navigation.php’;
require $theme_dir . ‘/inc/structure/post-meta.php’;
require $theme_dir . ‘/inc/structure/sidebars.php’;June 8, 2021 at 9:14 pm #1815628Rob
I haven’t touched the functions.php in the child theme, so it would just contain the code that it came with.
Thanks for your help 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.