Starting on line 235:
/**
* Filters post types array
*
* This filter can be used to hide post meta information of post, page or custom post type registerd by child themes or plugins
*
* @since Twenty Twenty 1.0
*
* @param array Array of post types
*/
$disallowed_post_types = apply_filters( 'twentytwenty_disallowed_post_types_for_meta_output', array( 'page' ) );
// Check whether the post type is allowed to output post meta.
if ( in_array( get_post_type( $post_id ), $disallowed_post_types, true ) ) {
return;
}
$post_meta_wrapper_classes = '';
$post_meta_classes = '';
But how to use this filter?
Let’s say I have registered a custom post type called ‘qualia’ and would like to use this filter to prevent meta from displaying. I can add ‘qualia’ to the array in the filter definition, like so:
$disallowed_post_types = apply_filters( 'twentytwenty_disallowed_post_types_for_meta_output', array( 'page', 'qualia' ) );
This is effective but seems wrong because the next theme update will overwrite template-tags.php.
My question is, how to make use of this filter in the child theme? Where to place the filter and how to correctly pass ‘qualia’ to it?
]]>https://www.ads-software.com/support/topic/how-can-i-add-the-number-of-comments-for-each-post-on-front-page/
But the code in functions.php isn’t looking familiar anymore for me to even paste that solution in place. Anybody else run into this or have a quick fix?
Thanks!
]]>You recently helped me out with a fix for the widgets.php which has totally solved the issue and I thank you very much.
Another little problem is that the theme appears to not display the commenters name when comments are left on posts. The demo of the theme appears to do the same thing so I assumed it may have been intentional. Perhaps the idea was to rely on Gravatars to identify commenters. Fair enough but I would prefer to have the commenters name displayed myself. It’s not an urgent problem because I have come up with a fix for now by hacking the inc/template-tags.php to display the commenters name, see here: https://frugalonfood.soblog.me/hughies-restaurant-st-albans/
I am actually running a child theme on that site with Fooding as the parent obviously. My problem is that I haven’t been able to get overrides for template-tags.php to work in the child theme so I had to make the above mentioned edit in the parent theme which I will have to do again every time there is an update for the theme. So what I’m asking for is some help to override template-tags.php in a child theme or even better (FEATURE REQUEST!) modify fooding theme to display commenter names.
What do you think?
]]>WordPress novice here. I have created a child theme of BHost to run my site: https://fit2communicate.com/. I wanted to remove the ‘Posted In’ and author details from posts and after searching through this forum looked into the template-tags.php (inc/template-tags.php) file.
I took a copy paste of the code before changing anything. Once I changed what I thought would fix the issue I tried and it didn’t – I just got the error message:
Parse error: syntax error, unexpected ‘edit_post_link’ (T_STRING), expecting ‘{‘ in /home1/commsess/public_html/fit2communicate.com/wp-content/themes/bhost/inc/template-tags.php on line 19
I put the code back as it was but I am still getting this error on the site and am now stuck.
Thanks in advance for any help you can give me.
Justin
]]>printf($entry_meta);
if(comments_open()){
printf(' <i class="fa fa-comments-o"></i><span class="screen-reader-text">%1$s </span> ',_x( 'Comments', 'Used before post author name.', 'nisarg' ));
comments_popup_link( __('0 Comment','nisarg'), __('1 comment','nisarg'), __('% comments','nisarg'), 'comments-link', '');
}
}
endif;
While we changed the code to
print($entry_meta);
It works now.
]]>Warning: urlencode() expects parameter 1 to be string, array given in /home4/abc/public_html/xyz/wp-content/themes/generatepress/inc/template-tags.php on line 38
Here’s is the link to the same question on the theme author’s support website…
https://generatepress.com/forums/topic/urlencode-error-message/#post-163004
https://www.ads-software.com/plugins/ultimate-wp-query-search-filter/
]]>inc/template-tags.php
. I created an inc
folder in my child theme and made the change. No effect. When I made the change in the parent theme template-tags.php
file the stacking order changed.
How do I get my child theme to point to the template-tags.php file in my child theme rather than the parent? I see you do regular updates to the Generatepress theme and I would rather not have to change the stacking order after each update. Is there a simple way to do this?
]]>