Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2 suggestions to your awesome plugin! #47

Open
timostsauber opened this issue Sep 5, 2018 · 1 comment · May be fixed by #50
Open

2 suggestions to your awesome plugin! #47

timostsauber opened this issue Sep 5, 2018 · 1 comment · May be fixed by #50

Comments

@timostsauber
Copy link

I have 2 minor suggestions I make locally to your awesome plugin, that fixes the only 2 issues we always have. I can make a pull request if you prefer, just let me know.

  1. Line breaks not respected.
    – In your get_content() method (line 534) of lj-maintenance-mode.php you are using wpautop, but not nl2br. Because you are not using the WordPress get_content, you are losing the line breaks. To fix this simply put nl2br after the wpautop line e.g.
    $content = apply_filters(‘wpautop’, $content);
    $content = nl2br($content);

  2. No html wrapper
    – Styling the css is limited because you don’t wrap the content in a div wrapper. If you were to wrap all the content in a div wrap (or even 2 would be better), then the styling possibilities would be far greater. e.g. we usually want our maintenance page to be a logo with contact details, center aligned vertical and horizontal. Without a div wrapper this is not possible.
    – An easy solution is this (line 560):
    return ‘

    ’ . $analytify . $code . $stylesheet . $widget_before . $content . $widget_after . ‘
    ’;

Thanks for such an aweosme plugin, I appreciate the simplicity!!

@john-lang-86
Copy link

john-lang-86 commented Jan 8, 2022

Hi Lukas and Tim,

Minor Request 1 (above)

Choosing not to implement in 2.5.1 as it generates <p></p><br> which messes with spacing, presentation and look-n-feel of any current maintenance mode content added to each site where the plugin is installed; which is not backward compatible with all existing installations.

Observation: While unit testing the proposed code enhancement, it was observed that the existing built in WordPress Rich Text Editor (RTE)(with Visual & Test edit mode tabs) did actually respect "\n" as a new line between paragraphs (</p> <p>).
It would output </p>&nbsp;<p> ... but only when the <p> had no-styling.
As soon as I did something like <p style="text-align: center;"></p> then wpautop() would delete the blank line.

Solution: When editing the RTE content on our sites; leave all newlines left aligned, with no RTE formatting, and then the new line would be identified, respected and left-alive in the generated output.
Sample: maintenance-mode-content-sample-www-dataprofessionals-com-au-.2022-01-09.2.txt
lj-maintenance-mode Sample Maintenance Page (2022-01-07)

Minor Request 2 (above)

Adding the two div's after the style seems to work well, while remaining backward compatible with any of us who are using the maintenance.min.css feature in our theme.

return $analytify . $code . $stylesheet . '<div class="ljmm-wrapper"><div class="ljmm-content">' . $widget_before . $content . $widget_after . '</div></div>';

lj-maintenance-mode 2 extra divs (2022-01-07)

Working solution available in forked Milestone.
All feedback is welcomed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants