Affichage des articles dont le libellé est Admin. Afficher tous les articles
Affichage des articles dont le libellé est Admin. Afficher tous les articles

samedi 12 novembre 2016

How to Add a Jump Menu in WordPress Admin Area



Do you want to easily jump to specific posts and pages for quick editing in WordPress admin area? Normally if you have a lot of content that you need to frequently update, then it becomes quite time consuming to locate that content in the WordPress admin area. In this article, we will show you how to add a jump menu in WordPress admin area to quickly edit posts and pages.


Add a Jump Menu in WordPress admin area


How Jump Menu Can Help You Work Faster in WordPress Admin?


WordPress admin area comes with a very straightforward and easy to use layout. You click on posts or pages to access the list of content filed under those post types.


If you have custom post types, like portfolio or testimonial, then you click on them to get a list of items you can edit.


Now if you have a lot of posts, pages, or custom post type, then it becomes quite difficult to browse them. You need to browse multiple pages or use the search feature on the posts screen which is not very fast or reliable.


Finding posts to edit in WordPress admin area


A jump menu can help you quickly search and edit content from anywhere inside the WordPress admin. This saves you a lot of time on finding and locating content to edit.


Having said that, let’s see how to easily add a jump menu in WordPress admin area for faster editing.


Adding Jump Menu to WordPress Admin Area


First thing you need to do is install and activate the WP Jump Menu plugin. For more details, see our step by step guide on how to install a WordPress plugin.


Upon activation, you will notice the WP Jump Menu appears in your WordPress admin toolbar. Clicking on it will display a search box. Simply start typing in the search box and the plugin will show results as you type.


Jump Menu in action


You can use the search box to find content. Use up and down arrow keys to move between results and hit enter key to edit a post. It is super fast and works like a charm.


WP Jump Menu works out of the box for posts and pages. You can enable it for other post types and media files as well.


You will need to visit Settings » Jump Menu Options page to configure plugin settings.


Enable post types from jump menu settings


First you will see a list of post types available on your WordPress site. Posts and pages will be checked by default. You can check the box next to other post types that you want to include.


Next, you will notice the styling options for WP Jump Menu.


Chose appearance and styling for jump menu


Here you can select the position of jump menu. The default position is in the WordPress admin bar. You can change that to a floating jump menu on top or bottom.


You can choose status colors for pending, draft, or published posts. Among other options you can show post IDs, set text alignment, show/hide jump menu on front-end, etc.


Don’t forget to click on the save settings button when you are done.


That’s all, we hope this article helped you learn how to add a jump menu in WordPress admin area to work more efficiently. You may also want to see our list of 25 most useful WordPress widgets for your site.


If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.


The post How to Add a Jump Menu in WordPress Admin Area appeared first on WPBeginner.







How to Add an Admin User in WordPress using FTP



Being locked of your WordPress admin is frustrating. That’s why we have shown you how to add an admin user in WordPress via MySQL. Recently one of our readers asked if it was possible to add an admin user in WordPress using FTP. Ofcourse it is. In this article, we will show you how to add an admin user in WordPress using FTP.


Adding an admin user in WordPress using FTP


Why You May Need to Add an Admin User in WordPress Using FTP?


Sometimes you may forget your username or email address on a WordPress site and cannot login to the admin area.


One way to do this is by adding an admin user to the WordPress database using MySQL. But you may be unable to connect to phpMyAdmin or don’t want to run MySQL queries directly.


Some users may get their site hacked and admin account deleted. In that case, adding an admin user using FTP can quickly restore your access to the WordPress admin area.


Having said that, let’s see how you can easily add an admin user in WordPress using FTP access.


Adding an Admin User in WordPress Using FTP


First thing you will need is an FTP client. If you are new to using FTP, then see our guide on how to use FTP to upload files in WordPress.


Once connected to your WordPress site, you need to locate your WordPress theme’s functions.php file. It would be at a location like this:


/yoursite.com/wp-content/themes/your-current-theme/functions.php


Right click on functions.php file and then select download. Your FTP client will download the functions.php file to your computer.


Downloading functions.php file to edit


Open the file you just downloaded on your computer using a plain text editor like Notepad. Now you need to add this code at the bottom of the file.



function wpb_admin_account(){
$user = 'Username';
$pass = 'Password';
$email = 'email@domain.com';
if ( !username_exists( $user ) && !email_exists( $email ) ) {
$user_id = wp_create_user( $user, $pass, $email );
$user = new WP_User( $user_id );
$user->set_role( 'administrator' );
} }
add_action('init','wpb_admin_account');


Don’t forget to replace Username, Password, and email@domain.com with your own values.


Next, save the file and then upload it back to your website using the FTP client.


You can now visit your WordPress site’s login area and sign in with the user account you just added.


Once you have logged in to your WordPress site, please edit the functions.php file and delete the code you added. Deleting the code will not remove the user you added, and you can always add new users and authors to your WordPress site.


We hope this article helped you learn how to add an admin user to WordPress using FTP. You may also want to see our list of 13 vital tips and hacks to protect your WordPress admin area.


If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.


The post How to Add an Admin User in WordPress using FTP appeared first on WPBeginner.







How to Reset WordPress Admin Password on Localhost



Recently, one of our users asked us how to reset WordPress admin password on localhost? If you are running WordPress on localhost and forget your password, then you can’t reset it by email. In this article, we will show you how to reset WordPress admin password on localhost.


How to reset WordPress admin password on localhost


Why Password Reset Doesn’t Work on Localhost?


The term localhost is used to describe a local server that is not available to the general public. For example: your personal computer.


Many WordPress users install WordPress on localhost (in their computer) to test changes, design websites, try out new plugins, and even learn WordPress.


If you haven’t tried it, then see our tutorial on how to install WordPress on your Windows computer using WAMP.


Mac users can follow instructions in our tutorial on how to install WordPress locally on Mac using MAMP.


Now here is the problem that some beginners may come across.


If you forget your WordPress admin password while working on localhost, then you will be NOT be able to reset it using the normal password reset option in WordPress.


The password reset option emails you a link to reset your WordPress password. In order to send emails, your server needs to enable the mail function.


This function is turned off by default on local servers which means WordPress will not be able to send the password reset email.


But don’t worry, there’s a way to reset your WordPress password on localhost.


Ready? Let’s get started.


Reset WordPress Admin Password on Localhost


We will be using phpMyAdmin to reset password on localhost. Simply visit phpMyAdmin control panel by typing this URL in your browser’s address bar:


http://localhost/phpmyadmin/


You will be asked to provide your MySQL username and password. Typically, the username is root with no password.


Once you are logged in, you need to select your WordPress database.


Select database


Once you select your database, you will see a list of tables in your WordPress database. Go ahead and click on the browse link next to WordPress users table.


Users table in WordPress database


You will now see the list of entries in your users table. The number of rows depend on how many users are registered on your WordPress site.


Next, you need to click on the Edit link next to the username of the admin user.


Browsing users table in WordPress DB


This will open up a form where you can edit the information stored in WordPress database for that user.


Changing user password


Scroll down to user_pass field and type a new password in the ‘value’ column. After that you need to select MD5 in the ‘function’ column.


Don’t forget to click on the Go button at the bottom to save your changes.


That’s all, you can now login to your WordPress site on localhost using the new password.


If for some reason you’re having a hard time following the phpMyAdmin method, then please look at our guide on how to create a WordPress admin user using your functions.php file. Simply open your theme’s functions.php file and paste the code in the article above, and you’ll be good to go.


We hope this article, helped you learn how to reset WordPress admin password on localhost. You may also want to see our guide on how to how to move WordPress from local server to live site.


If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.


The post How to Reset WordPress Admin Password on Localhost appeared first on WPBeginner.







How to Add Custom Admin Notices in WordPress



Do you want to add admin notices in WordPress? Admin notices are used by WordPress core, themes, and plugins to display warnings, notices, and important on screen information to users. In this article, we will show you how you can add admin notices in WordPress.


How to Add Admin Notices in WordPress


Why and When to Use Admin Notices in WordPress?


WordPress uses admin notices to alert users about errors, warnings, and success messages.


Example of a default WordPress admin notice


Individual site owners, plugin authors, and theme developers can also use admin notices.


If you are working on a website for clients who are not familiar with WordPress, then you can add admin notices to display helpful information across their WordPress admin area.


Custom admin notices can also be helpful if you run a multi-author WordPress site. You can add notices to guide new authors and help them find their way around.


However, we recommend using admin notices carefully. They can be really annoying and may ruin the WordPress experience for your users.


Having said that, let’s take a look at how you can add your own custom admin notices in WordPress.


Method 1: Add Custom Notices in WordPress Manually


This method requires you to add code to your WordPress site. If you have never added code before, then take a look at our guide on pasting snippets from the web into WordPress.


Let’s get started.


First you need to add this code to your theme’s functions.php file or a site-specific plugin.



function general_admin_notice(){
global $pagenow;
if ( $pagenow == 'options-general.php' ) {
echo '<div class="notice notice-warning is-dismissible">
<p>This notice appears on the settings page.</p>
</div>';
}
}
add_action('admin_notices', 'general_admin_notice');

This code displays a notice on the settings page with a yellow border and a button to close the notice. This is how it will appear on your site:


Custom admin notice example


If you study the code, you will notice that we have used $pagenow variable to detect the current page.


After that we added the condition that checks if the current page meets the page where we want to display the notice.


If it does, then we show the notice wrapped in a <div> element. This div element uses CSS classes already defined in the WordPress admin stylesheet for different type of notices.


You need to use notice class and then you can add notice-error, notice-warning, notice-success, or notice-info.


Optionally, you can use is-dismissible class which adds a button to close the notice.


Apart from checking the current page, you can add all kind of conditions to show notices matching different scenarios.


For example, you want to display a notice only to users with the author user role.


Here is how you will do that:



function author_admin_notice(){
global $pagenow;
if ( $pagenow == 'index.php' ) {
$user = wp_get_current_user();
if ( in_array( 'author', (array) $user->roles ) ) {
echo '<div class="notice notice-info is-dismissible">
<p>Click on <a href="edit.php">Posts</a> to start writing.</p>
</div>';
}
}
}
add_action('admin_notices', 'author_admin_notice');

As you can see that we have added an extra check to detect the user role in our function.


This is how it will appear on your site.


Custom notice by user role


Feel free to practice with different conditions, filters, and hooks to play with admin notices.


Method 2: Add Admin Notices Using a WordPress Plugin


This method is simpler as it does not require you to add code. However, it is not as flexible as the custom code method.


First thing you need to do is install and activate the KJM Admin Notices plugin. For more details, see our step by step guide on how to install a WordPress plugin.


Upon activation, you need to visit Settings » KJM Admin Notices page to configure plugin settings.


KJM Admin Notices settings


First, you need to check the option to enable KJM Admin Notices. The second option adds a custom post type where you can add and edit your custom admin notices.


The plugin also allows you to send an email to registered users when you publish a new notice. You can check the box next to ‘Send Email’ option if you want to use this feature.


You can also enable comments for your notices which will allow users to respond to notices by adding comments. To enable this feature, check the box next to ‘Allow Comments’ option.


Don’t forget to click on the save changes button to store your settings.


You will now see a new menu item labeled notices in your WordPress admin bar. This is where you can add and edit your custom admin notices.


Let’s create your first admin notice.


Visit Notices » Add Notice page. You will see a screen much like the WordPress post edit screen.


Add new custom notice


Start by adding a title for your notice, then add the actual notice in the post editor. You can select the notice category from the box on your right hand.


Next you need to select the user roles which will see this notice.


Select user roles that will see the notice


You can optionally show or hide title, author and date, and the button to dismiss notice.


Once you are finished, click on the publish button and your custom admin notice will go live.


KJM admin notices


KJM Admin Notices allows you to manage your custom admin notices without writing any code. You can delete or unpublish notices that you don’t want to display any more.


Using the email feature, you can also use it to alert all your users even if they don’t log in to check notices.


Having problems sending emails? See our guide on how to fix WordPress not sending email issue.


You may also want to take a look at WP Notification Center plugin. It adds a Facebook-like notification center in WordPress. Users can click on the notification icon to see their notifications.


Notification center


That’s all. We hope this article helped you learn how to add custom admin notices in WordPress. You may also want to see our guide on how to create a custom user registration form in WordPress.


If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.


The post How to Add Custom Admin Notices in WordPress appeared first on WPBeginner.


Page 5 – WPBeginner