Support

Home Forums Event Espresso Premium Single Event using page.php (instead of post layout)

Single Event using page.php (instead of post layout)

Posted: March 15, 2016 at 2:51 pm

Viewing 5 reply threads


kroskopf

March 15, 2016 at 2:51 pm

I want to use my theme’s page.php for displaying single events instead of the blog layout. The theme is Enfold. I’ve followed the instructions at the bottom of this page: https://eventespresso.com/wiki/ee4-custom-post-types/

1) Copied enfold/page.php to enfold-child/single-espresso_events.php
2) Added this line to enfold-child/functions.php: add_filter( ‘FHEE__EED_Event_Single__template_include__allow_custom_selected_template’, ‘__return_true’ );

But the single event is still being displayed as a blog post.

The plugin “What Template Am I Using?” is offering some clues:

  • My main Espresso page (dev.chicagochurch.org/registration) is using enfold/archive.php
  • A single event page is correctly using enfold-child/single-espresso_events.php
  • Other pages (non-blog) on my site are using enfold/template-builder.php

I also tried copying enfold/template-builder.php to enfold-child/single-espresso_events.php but still had the same blog look.

Any thoughts on how I can troubleshoot this? THANKS!


Josh

  • Support Staff

March 16, 2016 at 7:58 am

It sounds like the template switch worked for you, and I’ve verified using my own copy of Enfold. There may be some code in the templates that you’ll need to modify in order to remove blog-like elements. Can you spot in the page.php template (and also the includes/loop-page.php) the elements that you don’t want to be displayed?


kroskopf

March 16, 2016 at 10:50 am

When I visit my Espresso page at dev.chicagochurch.org/registration/ “What Template Am I Using?” says the post type is “espresso_events”. On my other Page type pages it says the post type is “page”.

Is there a way to make the post type come up as “page”?

Yes, the undesirable parts are a search bar on the right, date of the event creation, category of the event, name of event author, etc.

Thanks!


Josh

  • Support Staff

March 16, 2016 at 10:58 am

The instructions in the documentation are for changing a single Event post type template to use page.php, but it sounds like you want to change the event archive view. The archive URL is /registration/ with no event slug after it.

You can change the template used for the event archive by
1) copying the archive.php template to your child theme,
2) then rename it to be archive-espresso_events.php.
3) Then you remove the elements that you don’t want to appear.
4) Finally, you add the following to your child theme’s functions.php file:
add_filter( 'FHEE__EED_Event_Archive__template_include__allow_custom_selected_template', '__return_true' );


kroskopf

March 16, 2016 at 11:29 am

Yes, yes, of course! You’re helping me understand this.

So how do I get rid of the search bar (event archive and single event) and the date, category & author (event archive)? If this is beyond the scope of help you can provide, I completely understand. I certainly don’t expect you to code or teach me PHP!

https://codeshare.io/91h9r

https://codeshare.io/pO8n7


Josh

  • Support Staff

March 16, 2016 at 12:04 pm

The Date, category, and author are coming from the /includes/loop-index.php template part. You can remove the code that displays the date, category, and author code from the template part or copy the loop-index.php template part to your child theme and call it loop-event.php. Then in the archive-espresso_events.php template where it says
get_template_part( 'includes/loop', 'index' );

you can change it to be
get_template_part( 'loop', 'event' );

As far as the search bar goes, is that added by a widget? Can it be removed by removing the Search bar from the active Widget settings?

Viewing 5 reply threads

The support post ‘Single Event using page.php (instead of post layout)’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso