本文整理汇总了PHP中acf_get_admin_notices函数的典型用法代码示例。如果您正苦于以下问题:PHP acf_get_admin_notices函数的具体用法?PHP acf_get_admin_notices怎么用?PHP acf_get_admin_notices使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了acf_get_admin_notices函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: admin_notices
function admin_notices()
{
// vars
$admin_notices = acf_get_admin_notices();
// bail early if no notices
if (empty($admin_notices)) {
return;
}
foreach ($admin_notices as $notice) {
$open = '';
$close = '';
if ($notice['wrap']) {
$open = "<{$notice['wrap']}>";
$close = "</{$notice['wrap']}>";
}
?>
<div class="notice is-dismissible <?php
echo $notice['class'];
?>
"><?php
echo $open . $notice['text'] . $close;
?>
</div>
<?php
}
}
示例2: admin_notices
function admin_notices()
{
// vars
$admin_notices = acf_get_admin_notices();
if (!empty($admin_notices)) {
foreach ($admin_notices as $notice) {
$open = '';
$close = '';
if ($notice['wrap']) {
$open = "<{$notice['wrap']}>";
$close = "</{$notice['wrap']}>";
}
?>
<div class="<?php
echo $notice['class'];
?>
">
<?php
echo $open . $notice['text'] . $close;
?>
</div>
<?php
}
}
}
示例3: acf_add_admin_notice
function acf_add_admin_notice($text, $class = '', $wrap = 'p')
{
// vars
$admin_notices = acf_get_admin_notices();
// add to array
$admin_notices[] = array('text' => $text, 'class' => "updated {$class}", 'wrap' => $wrap);
// update
acf_update_setting('admin_notices', $admin_notices);
// return
return count($admin_notices) - 1;
}