Support » Plugin: Opening Hours » Is there an easy way to align mornings and afternoons horizontally?

  • Resolved ElectricFeet

    (@electricfeet)


    Great plugin; I’m just getting to grips with all the possibilities.

    I’m trying to replicate a current table that looks like this:

    Monday      10am – 1pm     2pm – 7pm
    
    Tuesday          –             –
    
    Wednesday        –         3pm – 7pm
    
    Thursday         –             –
    
    Friday       9am – 1pm     2pm – 6pm
    
    Saturday         –             – 

    Given the output from the plugin and using show_closed_days=true, I can work with CSS to get the opening times padded out.

    However, on the days where there is a morning-only or afternoon-only opening, I only have one entry to play with, so it appears on in the left “column” whether it is morning or afternoon.

    1. Is there some way to get the layout I need that I haven’t yet spotted in the (very extensive) shortcode attributes?

    2. This is a part-time business in several locations, and I currently get a sea of “Closed” text in the table, which looks a bit negative. Dashes would be really nice instead of “Closed”. Is there a filter for this?

    Thanks again for a great plugin!

    • This topic was modified 1 month, 3 weeks ago by ElectricFeet.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author janizde

    (@janizde)

    Hi,

    this is not possible with only shortcode attributes, but you can use the
    op_shortcode_template filter to specify your own template. You can have a look at the available parameters in the original template file

    as for 2) you can use the attribute caption_closed (it’s currently missing in the documentation).

    • This reply was modified 1 month, 3 weeks ago by janizde.

    Great! Thanks @janizde !

    For 1, I did a bit more research and have found the :only-child selector, which might allow me to hack a solution too, but I’ll go down the template path first before entering CSS hell.

    For 2: Hooray for undocumented features :-))

    Thanks so much for your help and a great plugin!

    @janizde Hmm. Re 1, no.

    It seems that going the template route is already too late in the process, because at that point the opening times are already marked up.

    I would really need to be able to filter $dayData['periodsMarkup'] — and even then the times have been translated into the various locales’ time-formats at that point, too.

    So any changes I could make in the template would have to be made (a) with some sort of regex to understand what I have — including figuring out whether I have a morning time or an afternoon time — and (b) with 3 sets of code (in my case for a tri-lingual site).

    So it’s back to the drawing board, I think. I either need another plugin or I need to lower my hopes for the table format … or to move to a country where they don’t close for lunch :-)))

    (I should add that I have just enough knowledge of php to get myself into trouble, but not enough to get myself out of trouble, so this is beyond my abilities at this point. I can manage actions/filters, and a little regex too, but re-writing plugin functions is beyond me.)

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.