Site logo

Archived topic

Little change in the function generate_do_post_meta_item

5 replies · Started by Raquel Requena López on August 10, 2020

Viewing posts 1–6 of 6

Hello:
Could you put a condition in the function of the file /themes/generatepress/inc/structure/post-meta.php function generate_do_post_meta_item?
if ( ! function_exists( 'generate_do_post_meta_item' ) {
function generate_do_post_meta_item( $item ) {
I need to make a theme child and have that function and every time I update the module I get an error and have to add it in the parent theme.
I have seen that in the file /themes/generatepress/inc/structure/comments.php function generate_comment have done it.
if ( ! function_exists( 'generate_comment' ) ) {
/**
* Template for comments and pingbacks
*
* Used as a callback by wp_list_comments() for displaying the comments.
*/
function generate_comment( $comment, $args, $depth ) {
Thanks

Hi there,

what changes are you trying to make to the post-meta.php?
As we can probably make those changes with Hooks.

Let us know

Hello,
I have the function in my functions.php file of my child theme and the problem is that it runs before the parent theme.
When it will call the parent function it gives an error because it already exists.
The changes are:
- Hide the date of the post if it's been more than 9 months
- Remove links to the author
However, if you were to put:
if ( ! function_exists( 'generate_do_post_meta_item' ) {
Before the show, I would solve my problem and it doesn't disturb the programming at all.
Thank you

Hello,
Very interesting these links, I didn't know that.
Thanks for the help, I close the topic

99% of the GP Theme controlled elements have a Filter Hook :)

Glad to be of help.

This archived topic is closed to new replies.