Hello again!
We need to hide the date field only on a certain custom post type. Since it seems to share CSS tags with all other posts and we have over 100 entries, adding a display: none to each of these is prohibitive. We’d prefer to create our own template to merely skip echoing this line, but the way Newsmag has nested this formatting is very convoluted. Is there a way to create a new single-custom.php template that will do this? Or is there a way to send the wp-booster code a flag to suppress the date on our specific custom post types?
Any help is greatly appreciated! Thanks!
Hi,
You could try to use this WordPress function which returns the post type: https://codex.wordpress.org/Function_Reference/get_post_type and add a condition to display or not the date depending of the post type or here is how you can create a custom post type template: https://codex.wordpress.org/Post_Type_Templates
Hope this helps!
Thanks
Unfortunately, it’s not helping… this all makes sense for a standard theme, but with the WP Booster framework, I can’t find where the date is being printed. I can’t even get a determination if single.php is being called for my custom post types–or even regular posts.
I’ve removed the ability to choose a template from my CPT (I inquired before on how to enable it, but ended up not needing this functionality).
Is there any reference you can point me to for how a page is generated within the WP Booster framework?
It seems like single.php calls the single_template_#.php which in turn calls loop-single-#.php. Within loop-single there are echo statements within the metadata for the post–however, I can not find a way to edit this and get any result to change any page. Are the #’s corresponding to the template choices in order? If it’s left as default, would that indicate that single.php -> loop.php or single.php->single_template_1.php->loop-single.php ?
Slight update: I’ve been digging in even more, and still cannot find a way to modify this. I assume it’s coming from one of the modules?
I’ve disabled any potential conflicting plugins I can think of. But custom post or not, I still can’t trace how the posts are being built to the point that I can stop the date output. I am using a child theme and I have followed the instructions in your documentation as well.
If you are using the default post template then you need to edit loop-single.php. Copy the file to the child theme and replace <?php echo $td_mod_single->get_date(false);?> with the code below.
<?php $postType = get_post_type( $td_mod_single->post->ID ); ?>
<?php
if ( 'YOUR_POST_TYPE_SLUG' == $postType ) {
} else {
echo $td_mod_single->get_date(false);
}
?>
-
This reply was modified 11 years by
shubhra.
I had just tracked it to this area and was hacking on the code. I’ll use this and take it from there! Thank you very much.
Working great so far. Now for the bonus section: how can I do this for the More Articles Box? I see the code to generate it in the wp_booster folder, but it’s being called in ways that are above my pay grade 🙂
Hi,
we have the theme api available https://forum.tagdiv.com/the-theme-api/ but it’s not yet fully documented. We have a tutorial about how to add new modules and blocks here: https://forum.tagdiv.com/practical-example-how-to-add-a-new-block-and-module/
@shubhra API it’s compatible vith curent version 1.7.1 and we are working hard at the new version, wich will be available in a few weeks.
@fusion If you wanna custom block 8 this is the file wich need to be modified td_blo9ck_8.php like here:
http://screencast.com/t/UCOBhq8Thn2
Thanks!
