Support

Home Forums Event Espresso Premium Injecting page-specific ID to an Event List page

Injecting page-specific ID to an Event List page

Posted: November 28, 2016 at 5:12 am

Viewing 4 reply threads


ICECadmin

November 28, 2016 at 5:12 am

Hello all,

We are using WordPress 4.6.1 with EventEspresso 4.9.16.p

I am looking for a way to utilize a page-specific ID for our event list page. Is there a way to inject one, or is there one that already exists? I could not find one from inspecting the page source.

So the background for this scenario is, currently we are using this parent category as our main Event list page. We had to use a category page like that because there are certain private events that we do not want listed on the website.

I need to remove the post metadata (labeled with the classes .post-meta.meta-data) which sits underneath the event title. The reason being that the “Date Posted” looks confusing and inconsistent next to our image of the event date. I’m not sure why EE is even set up by default to display this — surely on an event list page, you want to display the date of your event, which is of course never going to be the same as the date it was posted on the website. Maybe I am missing something here but I don’t quite understand the reasoning.

Regardless, however, the issue I’m running into is that the blog archive page uses the exact same labeling scheme, and there the post meta data actually serves a useful function. I need to be able to remove that <div> from just our main event-category page, or from all EE post archive pages.

If you could advise me on the simplest way to accomplish this, I would be so grateful.

Thank you!


ICECadmin

November 28, 2016 at 5:29 am

Ahh wow, I am kicking myself right now. I was actually looking at the wrong page source. The blog page uses a <div> while the EE archive page uses a <span>. So that is that.

Sorry about that!

But if there is a way to do a page-specific ID, I would still like to know as I have some other stuff in mind that may require it.

Thank you


ICECadmin

November 28, 2016 at 5:34 am

Gosh I feel like such a dunce today. I must be sleeping still because my eyes are not working.

The blog page does of course actually use the <span> as well, so my issue is still an issue.


Tony

  • Support Staff

November 28, 2016 at 5:53 am

Hi there,

I’m not sure why EE is even set up by default to display this — surely on an event list page, you want to display the date of your event, which is of course never going to be the same as the date it was posted on the website. Maybe I am missing something here but I don’t quite understand the reasoning.

EE is not setup to display that information, your theme is.

Your using the standard WP category listings which uses your theme to output the details, if your theme outputs the post_date for the posts list then that’s what is output to the page.

EE injects the event details into the_content and uses your theme to output the details as much as possible, we do this to keep event posts consistent with your other posts.

I need to be able to remove that div from just our main event-category page, or from all EE post archive pages.

Can you not just use the classes added to the body tag? If I understand correctly, you don’t need an ID to do what you need.

For example, to remove that element from EE category listings:

.tax-espresso_event_categories span.post-meta.meta-data {
    display: none;
}

To remove it from the EE archive page:

.post-type-archive-espresso_events span.post-meta.meta-data {
    display: none;
}

Combine that together:

.tax-espresso_event_categories span.post-meta.meta-data,
.post-type-archive-espresso_events span.post-meta.meta-data {
    display: none;
}

That should remove that section.

The body tag (if using body_class()) adds page specific classes that you can use for a whole host of context specific selectors.

Is that what you are looking for?


ICECadmin

November 28, 2016 at 6:07 am

Oh super, I don’t know how I missed that EE class in the <body> tag.

Thanks Tony. Sorry for the time wastage.

Viewing 4 reply threads

The support post ‘Injecting page-specific ID to an Event List page’ 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