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

Add admin notices new usage & .notice-alt examples #68

Merged
merged 2 commits into from
Dec 22, 2023
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
204 changes: 143 additions & 61 deletions patterns/admin-notices.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<?php
printf(
// translators: Leave always a hint for translators to understand the placeholders.
__( 'Define type via parameter (same as CSS classes) with <a href="%s" target="_blank">function add_settings_error()</a>, or use class(es) on a wrapping <code>div</code>.',
__( 'Define type via parameter (same as CSS classes) with function <a href="#" target="_blank"><code>add_settings_error()</code></a>, or use class(es) on a wrapping <code>div</code>.',
'WpAdminStyle' ), 'https://developer.wordpress.org/reference/functions/add_settings_error/'
);
?>
Expand All @@ -18,74 +18,156 @@
);
?>
</p>
<p>
<?php
printf(
// translators: Leave always a hint for translators to understand the placeholders.
__( 'Since WordPress version 6.4, the core includes function <a href="%s" target="_blank"><code>wp_admin_notice()</code></a> to standardize admin notices. See <a href="%s" target="_blank">this changeset on core.trac.wordpress.org</a> for further details.', 'WpAdminStyle' ),
'https://developer.wordpress.org/reference/functions/wp_admin_notice/',
'https://core.trac.wordpress.org/changeset/56408'
);
?>
</p>
<p>
<?php
_e( 'Note: The <code>inline</code> class is only to leave the notices here. On default WordPress will hide them via javascript.', 'WpAdminStyle' );
?>
</p>

<div class="notice notice-error inline">
<p>
<?php
printf(
// translators: Leave always a hint for translators to understand the placeholders.
esc_attr__( 'class %1$s with paragraph and %2$s class', 'WpAdminStyle' ),
'<code>.notice-error</code>',
'<code>.inline</code>'
);
?>
</p>
</div>
<div id="poststuff">
<div id="post-body" class="metabox-holder columns-2">
<div id="post-body-content">
<strong><?php _e("Standard style", 'WpAdminStyle'); ?></strong>

<div class="notice notice-warning inline">
<p>
<?php
printf(
// translators: Leave always a hint for translators to understand the placeholders.
esc_html__( 'class %1$s with paragraph and %2$s class', 'WpAdminStyle' ),
'<code>.notice-warning</code>',
'<code>.inline</code>'
);
?>
</p>
</div>
<div class="notice notice-error inline">
<p>
<?php
printf(
// translators: Leave always a hint for translators to understand the placeholders.
esc_attr__( 'class %1$s with paragraph and %2$s class', 'WpAdminStyle' ),
'<code>.notice-error</code>',
'<code>.inline</code>'
);
?>
</p>
</div>

<div class="notice notice-success inline">
<p>
<?php
printf(
// translators: Leave always a hint for translators to understand the placeholders.
esc_html__( 'class %1$s with paragraph and %2$s class', 'WpAdminStyle' ),
'<code>.notice-success</code>',
'<code>.inline</code>'
);
?>
</p>
</div>
<div class="notice notice-warning inline">
<p>
<?php
printf(
// translators: Leave always a hint for translators to understand the placeholders.
esc_html__( 'class %1$s with paragraph and %2$s class', 'WpAdminStyle' ),
'<code>.notice-warning</code>',
'<code>.inline</code>'
);
?>
</p>
</div>

<div class="notice notice-info is-dismissible inline">
<p>
<?php
printf(
// translators: Leave always a hint for translators to understand the placeholders.
esc_attr__( 'class %1$s with paragraph include %2$s and %3$s class', 'WpAdminStyle' ),
'<code>.notice-info</code>',
'<code>.is-dismissible</code>',
'<code>.inline</code>'
);
?>
</p>
</div>
<div class="notice notice-success inline">
<p>
<?php
printf(
// translators: Leave always a hint for translators to understand the placeholders.
esc_html__( 'class %1$s with paragraph and %2$s class', 'WpAdminStyle' ),
'<code>.notice-success</code>',
'<code>.inline</code>'
);
?>
</p>
</div>

<div class="notice notice-info is-dismissible inline">
<p>
<?php
printf(
// translators: Leave always a hint for translators to understand the placeholders.
esc_attr__( 'class %1$s with paragraph include %2$s and %3$s class', 'WpAdminStyle' ),
'<code>.notice-info</code>',
'<code>.is-dismissible</code>',
'<code>.inline</code>'
);
?>
</p>
</div>

<div class="notice notice-info inline">
<p>
<?php
printf(
// translators: %1$s is a code fragment for the notice information and %2$s is the inline class code.
esc_attr__( 'class %1$s with paragraph and %2$s class', 'WpAdminStyle' ),
'<code>.notice-info</code>',
'<code>.inline</code>'
);
?>
</p>
</div>
</div>
<div id="postbox-container-1" class="postbox-container">
<strong><?php _e("Alternative style", 'WpAdminStyle'); ?></strong>

<div class="notice notice-alt notice-error inline">
<p>
<?php
printf(
// translators: Leave always a hint for translators to understand the placeholders.
esc_attr__( 'with %1$s class', 'WpAdminStyle' ),
'<code>.notice-alt</code>'
);
?>
</p>
</div>

<div class="notice notice-alt notice-warning inline">
<p>
<?php
printf(
// translators: Leave always a hint for translators to understand the placeholders.
esc_attr__( 'with %1$s class', 'WpAdminStyle' ),
'<code>.notice-alt</code>'
);
?>
</p>
</div>

<div class="notice notice-alt notice-success inline">
<p>
<?php
printf(
// translators: Leave always a hint for translators to understand the placeholders.
esc_attr__( 'with %1$s class', 'WpAdminStyle' ),
'<code>.notice-alt</code>'
);
?>
</p>
</div>

<div class="notice notice-alt notice-info is-dismissible inline">
<p>
<?php
printf(
// translators: Leave always a hint for translators to understand the placeholders.
esc_attr__( 'with %1$s class', 'WpAdminStyle' ),
'<code>.notice-alt</code>'
);
?>
</p>
</div>

<div class="notice notice-info inline">
<p>
<?php
printf(
// translators: %1$s is a code fragment for the notice information and %2$s is the inline class code.
esc_attr__( 'class %1$s with paragraph and %2$s class', 'WpAdminStyle' ),
'<code>.notice-info</code>',
'<code>.inline</code>'
);
?>
</p>
<div class="notice notice-alt notice-info inline">
<p>
<?php
printf(
// translators: %1$s is a code fragment for the notice information and %2$s is the inline class code.
esc_attr__( 'with %1$s class', 'WpAdminStyle' ),
'<code>.notice-alt</code>'
);
?>
</p>
</div>
</div>
</div>
<br class="clear">
</div>
Loading