• Resolved James Andrews

    (@thenetimp)


    Can you please not over ride the_content. I don’t want all the meta data at the top of my event. I went from 1.7.1 to 1.7.2 and all of a sudden info that I want somewhere else is at the top of the content. This is poor for user customization. Instead just give us access to the functions and let us customize our own template. I am evaluating this for a site I will be managing. If the_content is to be over ridden and un-customizable I’ll have to choose a different plugin, and I have already spent much time customizing templates, so at this moment am rather annoyed.

    http://wordpress.org/extend/plugins/event-organiser/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Stephen Harris

    (@stephenharris)

    Hi James,

    I understand your concern, the reason for this is to improve theme compatibility. A lot of users want a ‘plug and play’ approach.

    That said, nothing has (philosophically) changed in the 1.7 update – the plug-in only uses the_content filter if an appropriate template (namely single-event.php) is not found in your theme. So by creating your own single-event.php template in your theme, you won’t get all the default stuff chucked in.*

    I’ve worked hard to find a solution that retains the ability of the user to complete customise the template, while providing something that should work ‘as is’ with pretty much any theme. I think this achieves that.

    Theme compatibility issues & customisation are the big features I’ve been trying to improve which is why in this update, templates are provided for the event list widget and shortcode – which means you’re no longer restricted to the stand ordered list HTML.

    Returning to the_content issue, an alternative is to remove the default content with the following:

    add_filter('template_include', 'james_remove_the_content_callback', 15);
    function james_remove_the_content_callback( $template ){
         remove_filter( 'the_content', '_eventorganiser_single_event_content');
        return $template;
    }

    (*Please note 1.7 + 1.7.1 had bugs relating to templates but they should be dealt with in 1.7.2).

    Plugin Author Stephen Harris

    (@stephenharris)

    Regarding creating your own templates you may find this page helpful: http://wp-event-organiser.com/documentation/editing-the-templates/ and also the function reference page: http://wp-event-organiser.com/documentation/function-reference/

    Thread Starter James Andrews

    (@thenetimp)

    Hello Stephen,

    Thank you for your quick response. I have created my theme from scratch and have included a single-event.php file. When I use the_content() in my template that’s when I get all the meta data at the top?

    Wouldn’t a better approach to plug and play be to not over-ride the the_content, but instead in the theme default templates add the code there to call what you want. That way if someone who wants to layout the info the way they want it can just look at what you are calling in the template and put it where they want.

    something like:
    ` eo_display_meta_block(); the_content()’

    In the template Would do the same thing, but make it 100x more customizable for those of us who are competent enough to customize a page. I am guessing my problem stems from your bugs that were displaying the wrong template which I why I had thought it was going to work the way I wanted.

    In the end I’ll take your advice and remove the filter, it did remove the meta, but it’s be nice if I didn’t have to hack around it.

    Plugin Author Stephen Harris

    (@stephenharris)

    Ah poo. There’s a bug in 1.7.2 (Could have sworn it worked when I tested it). See this line: https://github.com/stephenharris/Event-Organiser/blob/1.7.2/includes/event-organiser-templates.php#L229

    Instead of

    if( is_singular('event') && !eventorganiser_is_event_template($template,'single') ){

    It should be

    if( is_singular('event') && !eventorganiser_is_event_template($template,'event') ){

    That should fix it. I’ll release an update shortly. (Alternatively there is an option in the plug-in settings to completely turn off any template handling by the plug-in).

    Wouldn’t a better approach to plug and play be to not over-ride the the_content, but instead in the theme default templates add the code there to call what you want. That way if someone who wants to layout the info the way they want it can just look at what you are calling in the template and put it where they want.

    This was essentially the old way of doing it, yes. And actually there is a default single-event.php template that isn’t used, but is there so users can quickly copy into their theme and make alterations. That includes a call to a function to display event meta – which itself uses a second template so how event meta is displayed can be altered independently of ‘single-event.php`.

    The trouble is that default templates don’t work with all themes. (You have to guess the HTML structure and class names etc). This resulted in a few ‘bug’ reports. The idea now is that it uses the_content to get around this, but if you want to completely over-ride the template you simply create the appropriate template in your theme. So it is 100x more customisable :).

    The fact that the_content was still being used is a bug and shouldn’t be the case :).

    And I agree totally about not liking plug-ins adding stuff on the_content – its something I changed reluctantly – but I’ll will always ensure it easy to completely over-ride the templates (bugs excepting 🙂 ).

    Thread Starter James Andrews

    (@thenetimp)

    LOL… Well glad it’s considered a bug. I’ll wait for the update, but you may also want to check the bug I just posted as well before you push code, may be an easy fix. Kill 2 pigs with one bird.

    Thread Starter James Andrews

    (@thenetimp)

    Confirming this issue is resolved as of 1.7.3 thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘the_content filter’ is closed to new replies.