Digital experiences for all disciplines
New Landing › How can we help? › Cardinal › How to remove notices to install plugins of theme cardinal for not administrator
New Landing › How can we help? › Cardinal › How to remove notices to install plugins of theme cardinal for not administrator
- This topic has 9 replies, 3 voices, and was last updated 9 years by Mohammad – SUPPORT.
-
Posted in: Cardinal
-
August 27, 2014 at 9:33 am #104428
How to remove notices to install plugins of theme cardinal for not administrator or for all.
Attachments:
You must be logged in to view attached files.August 27, 2014 at 8:12 pm #104646Hi,
Add this in the functions.php before the ?>
add_filter('get_user_metadata', function($val, $object_id, $meta_key, $single) { if($meta_key === 'tgmpa_dismissed_notice') return true; else return null; }, 10, 4);
It will remove the notice.
Let me know, what you got.
Thanks,
laranz.August 28, 2014 at 9:49 am #104820ERROR
Parse error: syntax error, unexpected T_FUNCTION in /xxxxx/wp-content/themes/cardinal-child/functions.php on line 62
August 28, 2014 at 7:59 pm #104993Hi,
Try that in the parent themes functions.php or you do it wrong in the functions.php in the Child theme. Could you share us the functions.php in the child theme, so that I can check whats syntax wrong in that.
Let us know,
Thanks,
laranz.August 29, 2014 at 7:39 am #105121Hi,
The code in the child theme:
<?php
/*
*
* Cardinal Functions – Child Theme
* ————————————————
* These functions will override the parent theme
* functions. We have provided some examples below.
*
*
*//* LOAD THEME LANGUAGE
================================================== */
/*
* You can uncomment the line below to include your own translations
* into your child theme, simply create a “language” folder and add your po/mo files
*/// load_theme_textdomain(‘swiftframework’, get_stylesheet_directory_uri().’/language’);
/* REMOVE PAGE BUILDER ASSETS
================================================== */
/*
* You can uncomment the line below to remove selected assets from the page builder
*/// function spb_remove_assets( $pb_assets ) {
// unset($pb_assets[‘parallax’]);
// return $pb_assets;
// }
// add_filter( ‘spb_assets_filter’, ‘spb_remove_assets’ );/* ADD/EDIT PAGE BUILDER TEMPLATES
================================================== */
function custom_prebuilt_templates($prebuilt_templates) {/*
* You can uncomment the lines below to add custom templates
*/
// $prebuilt_templates[“custom”] = array(
// ‘id’ => “custom”,
// ‘name’ => ‘Custom’,
// ‘code’ => ‘your-code-here’
// );/*
* You can uncomment the lines below to remove default templates
*/
// unset($prebuilt_templates[‘home-1’]);
// unset($prebuilt_templates[‘home-2’]);// return templates array
return $prebuilt_templates;}
//add_filter( ‘spb_prebuilt_templates’, ‘custom_prebuilt_templates’ );/* POST SHARE
================================================== */
if (!function_exists(‘sf_post_share’)) {
function sf_post_share() {
$image = wp_get_attachment_url(get_post_thumbnail_id());
$share_text = apply_filters(‘sf_post_share_text’, __(“Share this”, “swiftframework”));
?><?php edit_post_link(‘ Editar anuncio’, ‘<p><i class=”fa fa-pencil-square-o”></i>’, ‘</p>’); ?>
<div class=”article-divider”></div>
<div class=”article-share” data-buttontext=”<?php echo $share_text; ?>” data-image=”<?php echo $image; ?>”></div>
<?php }
}
add_action(‘sf_post_content_end’, ‘sf_post_share’, 30);
/* END POST SHARE
================================================== *//* POST INFO
================================================== */
if (!function_exists(‘sf_post_info’)) {
function sf_post_info() {
global $post;
$author_info = sf_get_post_meta($post->ID, ‘sf_author_info’, true);
if (is_singular(‘directory’)) {
$author_info = true;
}
$post_categories = get_the_category_list(‘, ‘);
?><?php if ($author_info) { ?>
<div class=”author-info-wrap clearfix”>
<div class=”author-avatar”><?php if(function_exists(‘get_avatar’)) { echo get_avatar(get_the_author_meta(‘ID’), ‘140’); } ?></div>
<div class=”author-bio”>
<div class=”author-name” itemprop=”author” itemscope itemtype=”http://schema.org/Person”><h3 class=”vcard author”><span itemprop=”name” class=”fn”><?php the_author_meta(‘display_name’); ?></span></h3></div>
<div class=”author-bio-text”>
<?php the_author_meta(‘description’); ?>
</div>
</div>
</div>
<?php } ?>
<?php if ($author_info) { ?>
<div class=”post-info clearfix”>
<?php } else { ?>
<div class=”post-info post-info-fw clearfix”>
<?php } ?><?php if ($post_categories) { ?>
<div class=”categories-wrap”><?php _e(“Categorias:”, “swiftframework”); ?>
<span class=”tags”><?php echo sprintf(__(‘%1$s%3$s’), $author_name, $author_url, $post_categories); ?></span></div>
<?php } ?><?php if (has_tag()) { ?>
<div class=”tags-wrap”><?php _e(“Tags:”, “swiftframework”); ?><span class=”tags”><?php the_tags(”); ?></span></div>
<?php } ?>
<div class=”comments-likes”>
<?php if ( comments_open() ) { ?>
<div class=”comments-wrapper”><i class=”ss-chat”></i><span><?php comments_number(__(‘0 Comments’, ‘swiftframework’), __(‘1 Comment’, ‘swiftframework’), __(‘% Comments’, ‘swiftframework’)); ?></span></div>
<?php } ?>
<?php if (function_exists( ‘lip_love_it_link’ )) {
lip_love_it_link(get_the_ID(), true, ‘text’);
} ?>
</div>
</div>
<?php }
}
add_action(‘sf_post_content_end’, ‘sf_post_info’, 40);/* END POST INFO
================================================== *//* DISMISS NOTICE
================================================== */add_filter(‘get_user_metadata’, function($val, $object_id, $meta_key, $single)
{
if($meta_key === ‘tgmpa_dismissed_notice’)
return true;
else
return null;}, 10, 4);
/* END DISMISS NOTICE
================================================== */?>
August 29, 2014 at 7:41 am #105122archive functions.php
Attachments:
You must be logged in to view attached files.August 29, 2014 at 11:22 pm #105380Hi,
Can you try this.
add_filter( 'get_user_metadata', function_disableNotice, 10, 4 ); function function_disableNotice ($val, $object_id, $meta_key, $single) { if($meta_key === 'tgmpa_dismissed_notice') { return true; } else { return null; } }
Instead of the old code I sent, I think that didn’t work because of the PHP version.
Let us know,
Thanks,
laranz.August 30, 2014 at 10:55 am #105483Hi Laranz.
Thanks for your help, it works perfect!.
Thanks very much!
August 30, 2014 at 11:03 am #105484Hi,
Glad it works 🙂
Let us know, if you have any other questions.
Thanks,
laranz.December 21, 2015 at 9:31 am #236750Hi,
Please paste this code functions.php of child theme.function hide_update_notice_to_all_but_admin_users() { if (!current_user_can('update_core')) { remove_action( 'admin_notices', 'update_nag', 3 ); } } add_action( 'admin_head', 'hide_update_notice_to_all_but_admin_users', 1 );
Thanks
Mohammad -
Posted in: Cardinal
You must be logged in and have valid license to reply to this topic.