Project

General

Profile

Actions

Support #10766

closed

Events Manager and Posts

Added by Mark Webb over 5 years ago. Updated over 5 years ago.

Status:
Rejected
Priority name:
Normal
Assignee:
-
Category name:
-
Target version:
-
Start date:
2018-11-29
Due date:
% Done:

0%

Estimated time:
Deployment actions:

Description

Hi,

I am wondering if there is anyway to get events generated in events manager to appear automatically as posts so that they can be displayed on the home page along with other posts. I am currently using the 2011 theme. If this is not possible, I have a second question.

I am doing work for the CPCP (http://cpcp.commons.gc.cuny.edu) and updated their page and switched to a new theme. The old theme was a child theme created by someone else called "Mellon Committee Sites." I am not sure all of the features on this child theme but one was that event manager events showed up automatically as posts on the front page. I can go back to this child theme but I need to update the site aesthetically which means placing a new banner image and adjusting the color scheme. When I go to "customize," however, within the Mellon Committee Child theme, I am unable to change anything where the banner is. It appears to be coded into the site and no longer flexible. How might I make this change?

thanks,
Mark


Files

mellontheme.tar.gz (378 KB) mellontheme.tar.gz Boone Gorges, 2018-12-04 10:49 AM
Actions #1

Updated by Boone Gorges over 5 years ago

Hi Mark - I've attached a tarball of the old 'Mellon Committee Sites' theme. A brief look suggests that an events loop is hardcoded into home.php. You can accomplish something similar in a 2011 child theme, or you could modify mellontheme (which is a child of twentytwelve) to look the way you'd like.

I'm glad to give more guidance on how to submit a child theme (and we can use this ticket for it) but I'm going to close this ticket since there is no bug here for me to fix. Thanks!

Actions #2

Updated by Mark Webb over 5 years ago

Great thanks!

I would love to create a 2011 childtheme with the same events loop hardcoded into the home.php. I don't have any experience doing such a thing, is it difficult?

Actions #3

Updated by Boone Gorges over 5 years ago

Hi Mark - It's not very difficult, but will be a challenge if you've never worked with WordPress themes before. https://codex.wordpress.org/Child_Themes is a good place to start.

Actions #4

Updated by Mark Webb over 5 years ago

I am very familiar with wordpress themes, I just have never created a child theme. I opened the Mellon Committee tar file. Is there a simple way to duplicate most of the stuff in there and connect it to the theme I am now using?

Actions #5

Updated by Boone Gorges over 5 years ago

Child themes inherit all of their functionality/templates from the parent theme; this is what makes them a child theme. https://developer.wordpress.org/themes/advanced-topics/child-themes/ has some more info. You'll just need to override those templates that you actually want modified. So it's likely that your child theme will have only two or three files in it.

Actions #6

Updated by Mark Webb over 5 years ago

Thanks. I have been doing some reading about creating a child theme and I think I understand the general principles. I basically need a style css sheet and a function php to enqueue it right? A couple of questions with regard to each piece:

1) How do I find the templates that I want to override? Can I examine the mellonthemes CSS sheet to identify the css line I am looking for or do I need to inspect the css on my page and find the right css code to rewrite it? I am basically just trying to get the events pages to appear as posts on the front page...

2) How do create a functions php on the commons? Is there a way to set up a ftp account there?

thanks,
Mark

Actions #7

Updated by Boone Gorges over 5 years ago

Hi Mark -

You'll want to start with a local installation of WordPress. This will let you do your development and research in a space other than the production environment. How this works depends on your machine, but here is a pointer in the right direction: http://webdesignerwall.com/tutorials/installing-wordpress-locally

1) How do I find the templates that I want to override? Can I examine the mellonthemes CSS sheet to identify the css line I am looking for or do I need to inspect the css on my page and find the right css code to rewrite it? I am basically just trying to get the events pages to appear as posts on the front page...

Once you've created the child theme shell (style.css w/proper 'Template' header + functions.php) and activated it locally, you'll be able to determine templates in one of several ways. One is to browse through the parent theme templates. Another is to install a plugin like https://wordpress.org/plugins/query-monitor/, which (among many other useful features) will tell you at least the top-level template you're looking at on a given page. But generally, you'll just have to search through the parent theme. Then, copy the appropriate theme to your child theme directory, and begin editing.

Create your child theme locally. Once it's ready for me to review, create a new ticket here on Redmine, with either the URL of a GitHub repo etc, or a zip file containing the child theme. I will then slate it for release to the production site. See https://dev.commons.gc.cuny.edu/hosting-partner-handbook/ and https://dev.commons.gc.cuny.edu/release-schedule-and-procedures/ for more details.

Actions #8

Updated by Mark Webb over 5 years ago

Thanks again.

I have a local install and I have copy pasted all of the 2011 theme into a new childtheme folder. I activated query monitor but don't have the first idea as to how to use it. I am not sure what I am looking for in the templates or what I would need to change to make it do what I want. I want to get the events pages to show up as posts just like in the mellon themes. Is there something in the mellon committee child theme that would give me a hint as to what I am looking for?

Mark

Actions #9

Updated by Mark Webb over 5 years ago

and now I think I messed everything up. I deleted the style sheet of my child theme and copy pasted the style sheet from the mellon committee child theme just to see what would happen and now I get this message:

Fatal error: Cannot redeclare twentyeleven_scripts_styles() (previously declared in C:\xampp\htdocs\CPCP\wordpress\wp-content\themes\CPCP CHILD Test\functions.php:285) in C:\xampp\htdocs\CPCP\wordpress\wp-content\themes\twentyeleven\functions.php on line 286

When I undo the change I make I still get this message. What can I do to get back to normal functioning on my local hosting?

thanks,
Mark

Actions #10

Updated by Mark Webb over 5 years ago

Nevermind, ignore the last post, I figured out how to get it back running. I still am confused about how to sort through the templates, though. Thanks

Actions #11

Updated by Boone Gorges over 5 years ago

Hi Mark -

Child themes should not be copies of parent themes. They should consist of (a) a style.css containing only your additional styles, (b) a functions.php consisting of the parent theme's style enqueue and whatever additional PHP you need, and (c) overrides of only the templates that you need to make modifications to. The rest is inherited from the theme you specify with the "Template" header.

I urge you to look carefully at the various sections of https://developer.wordpress.org/themes/advanced-topics/child-themes/. The concept of child themes is explained there, along with copy-and-paste boilerplate for much of what you'll need to get a functional child theme running locally. There's even a section https://developer.wordpress.org/themes/advanced-topics/child-themes/#adding-template-files with tips on how to find out which template you need to modify.

You can also have a look at the existing child theme I attached earlier to this ticket. It should give you a sense of how the template mods work, at least in the case of that specific theme. See especially home.php and content-event.php.

More generally, I should flag here that the Commons team is unfortunately not staffed to provide in-depth instruction on building WordPress themes and other customizations. It's important that organizations creating custom themes for the Commons have the internal staffing to do most building and troubleshooting themselves.

Actions #12

Updated by Mark Webb over 5 years ago

Thanks again,

It struck me that rather than try and design a child theme, I should just look into events plug-ins that already do what I want. I am now looking at the "events organizer" plugin. I understand that this plugin creates events that act like posts. However, when I create an event with it, my event does not appear on the front page, nor does it hook-up with the publicize features from jetpack which should kick it out automatically to facebook and twitter. The events page itself also just shows up as a blank page that says "event details: date." Perhaps it is not publishing at all. Currently I have both this plugin and the events calendar plugin set up because I need the most recent event to show up on the front page, but even when I deactivate event calendar, events organizer does not seem to be working.

thanks,
Mark

Actions #13

Updated by Boone Gorges over 5 years ago

Hi Mark - The Event Organiser plugin is similarly named to Events Manager, but the two are distinct and mutually inconsistent - they use data schemas that clash with one another. So it's not possible to run them both at the same time.

The underlying issue is that both Event Organiser and Events Manager store their content as WordPress "custom post types". They are like "posts" in the sense that they're stored in the same place in the database. But they're different from the point of view of WP templates, which generally expect to show posts of type 'post' on the home page, not posts of the type 'event'. To do the latter, you almost certainly need some customization - or perhaps a widget that's intended to do something similar. It appears that Events Manager may have such widgets built in: http://wp-events-plugin.com/documentation/wordpress-event-widgets/ I recommend reading more into their documentation.

Actions

Also available in: Atom PDF