Support

Home Forums Event Espresso Premium Customizing CSS to remove "comments are closed" from class page

Customizing CSS to remove "comments are closed" from class page

Posted: April 12, 2020 at 12:25 am


SanMateoCPRClasses

April 12, 2020 at 12:25 am

We’ve upgraded from an EE3 site using a custom theme and code (from a developer who is no longer around) to EE4 and have been able to work around all of that with only one exception remaining. On the class pages (example link below) in the lower left you’ll see “Comments are closed” that I haven’t been able to get rid of or hide. ACF Pro was used to hide the other post related fields (discussion, comments, revisions, slug, author, format, page attributes, featured image, categories, tags, send trackbacks.). “Comments are closed” is a <p> and there are other <p>s on the page, so I can’t use display to hide it, and I don’t see any other selector to use. Any creative suggestions on another way to deal with this would be much appreciated.
Example page link: https://wordpress-118619-989042.cloudwaysapps.com/events/bls-for-healthcare-providers-cpr-526/


Josh

  • Support Staff

April 13, 2020 at 8:37 am

Hi,

May I ask can you edit your theme’s files? If so, you can remove the “Comments are Closed” markup from the theme’s single.php template.

Another solution would be to add some PHP code to your theme’s functions.php file or into a site specific plugin that switches the template to use the theme’s page.php template instead. You can use the example here:

https://github.com/eventespresso/ee-code-snippet-library/blob/master/templates/jf_ee_custom_post_type_template.php

You can add the above to a functions plugin or the theme’s functions.php file.


SanMateoCPRClasses

April 13, 2020 at 4:58 pm

Yes, this one-off theme does allow customization (it’s already been customized in combination with the ACF Pro plugin however, so I’m not at a known starting point).

But…since I had to build the plugin in order to keep using ACF Pro, could I add the code you’re referencing above to that?


Josh

  • Support Staff

April 13, 2020 at 6:37 pm

Yes you could add the code to a plugin you’ve already built. Or you could add the code into the theme’s functions.php file. Adding the code to the theme’s functions.php might be better in case if you ever switch the site to use a different theme.


SanMateoCPRClasses

April 13, 2020 at 7:18 pm

I guess I’ll give the code a try as part of the plugin to see if moving from post to page breaks any of the customizations the previous developer added to EE3 and are still there in EE4.

If/when I change themes later, I’ll go to one that handles the post layout/comments, etc. issue properly, and will then dump ACF Pro, so I’m not worried about that. But between using the plugin I built and functions.php, which is less likely to be an issue when you issue EE4 updates/upgrades?


Tony

  • Support Staff

April 14, 2020 at 4:13 am

Functionality wise, neither.

functions.php essentially is a plugin, just built into the theme itself so it always loads with the theme. You can run into issues with either one running too ‘late’ in the request (usually with functions.php so you would use a plugin) but that’s very unlikely to happen with the snippet in use here.

Using a plugin vs functions.php boils down to what that functionality is for, if it’s specifically for the theme you are using, use functions.php. If it alters functionality that you would want to keep if you change theme then put the functions into a custom functions plugin for the site.

You must be logged in to reply to this support post. Sign In or Register for an Account

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3 Documentation for Event Espresso 4

Status: publish

Updated by  Tony 1 month, 1 week ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!