• Resolved daniel25k

    (@daniel25k)


    Hi

    I would like to display my phone number on the website always from Monday 08 am in the morning until Friday 18 pm in the evening and otherwise a text that we are not available by phone. I have tried all possible combinations with shortcodes but somehow it does not work. Is it possible at all?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Arno Welzel

    (@awelzel)

    A shortcode will not work for that, you need to create a server side rule with the following data:

    Start: 2023-03-13, 8:00 (that is a mondy)
    End: 2023-03-17 18:00 (this is a friday)
    Repeat: weekly

    In the shortcode you will then use that rule.

    Thread Starter daniel25k

    (@daniel25k)

    Ok thank for the quick reply.

    But just for my understanding… so i have make 2 rules one like above for showing my telnumer and a second rule for the weekend with showing my Text right? so i dont have to make a hide rule? i guess

    • This reply was modified 1 year, 11 months ago by daniel25k.
    Plugin Author Arno Welzel

    (@awelzel)

    Correct – a server side rule can either show or hide content.

    If the rule is defined to show content, then the content will be hidden outside the defined time frame. If the rule should hide content, the content will be visible outside the timeframe.

    Thread Starter daniel25k

    (@daniel25k)

    Ok thanks a lot… worked perfect on pages and footer.

    Only in my header it does not work. i read that wordpress does often not support shortcodes in the header… alotugh its just the top bar an i can use html so i tried to make the shortcode work in html on my top bar here https://lichtundton.at/

    At the moment its filled with email and phone number with html… when i paste the shortcode it only shows the entire shortcode. i tried to add_filter in php for widget_text… that works on sidebars but no on the top bar… any ideas why?

    Plugin Author Arno Welzel

    (@awelzel)

    Wether shortcodes work outside regular content also depends on the template as well. It’s the responsibility of the template to combine header, footer, widget area and main content area.

    If the template is not using the WordPress backend API (in particular the function do_shortcode()) to process shortcodes in the header, then they will not work there. Since shortcodes are intended to be used in content and not in headers and widgets, it is very likely that this will not work with most of the existing templates.

    • This reply was modified 1 year, 11 months ago by Arno Welzel.
    Plugin Author Arno Welzel

    (@awelzel)

    PS: I believe the designer is very proud of the 3D effect with the partial background unblurring when moving the mouse on the start page of the website – but it’s horrible for performance. On my Dell Latitude 5430 laptop running at 4K with an external display the whole thing is really sluggish until you scroll down to hide the animation. Depending on what your audience is, you may think about changing this.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Hide and Show in one Shortcode’ is closed to new replies.