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

Conditionally load "coming soon" inline styles only for logged-in users #39

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 43 additions & 41 deletions includes/ComingSoon.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,52 +249,54 @@ public function notice_display() {
* Some basic styles to control visibility of the coming soon state in the admin bar
*/
public function admin_bar_coming_soon_admin_styles() {
?>
<style>
#nfd-site-status {
align-items: center;
background-color: #F8F8F8;
border-radius: 2px;
border-style: solid;
border-width: 1px;
color: #333333;
display: flex;
font-weight: 500;
gap: 2px;
height: 22px;
margin-top: 4px;
padding: 0 14px;
}

#wpadminbar #wp-admin-bar-site-status .ab-item{
height:22px;
}
if( is_user_logged_in() ) {
?>
<style>
#nfd-site-status {
align-items: center;
background-color: #F8F8F8;
border-radius: 2px;
border-style: solid;
border-width: 1px;
color: #333333;
display: flex;
font-weight: 500;
gap: 2px;
height: 22px;
margin-top: 4px;
padding: 0 14px;
}

#nfd-site-status[data-coming-soon="true"] {
border-color: var(--Dark-Red, #C71919);
}

#nfd-site-status[data-coming-soon="false"] {
border-color: var(--A11y-GRN, #278224);
}
#wpadminbar #wp-admin-bar-site-status .ab-item{
height:22px;
}

#nfd-site-status span {
display: none;
text-transform: uppercase;
font-weight: 500;
}
#nfd-site-status[data-coming-soon="true"] {
border-color: var(--Dark-Red, #C71919);
}

#nfd-site-status[data-coming-soon="false"] {
border-color: var(--A11y-GRN, #278224);
}

#nfd-site-status[data-coming-soon="true"] #nfd-site-status-coming-soon {
color: var(--Dark-Red, #C71919);
display: inline-block;
}
#nfd-site-status span {
display: none;
text-transform: uppercase;
font-weight: 500;
}

#nfd-site-status[data-coming-soon="false"] #nfd-site-status-live {
color: var(--A11y-GRN, #278224);
display: inline-block;
}
</style>
#nfd-site-status[data-coming-soon="true"] #nfd-site-status-coming-soon {
color: var(--Dark-Red, #C71919);
display: inline-block;
}

#nfd-site-status[data-coming-soon="false"] #nfd-site-status-live {
color: var(--A11y-GRN, #278224);
display: inline-block;
}
</style>
<?php
}
}

/**
Expand Down