Add a Button/Change Menu Item Color to WordPress Menu Bar

The following article was helpful in getting started adding a button to the WordPress menu bar.

https://www.wpbeginner.com/wp-tutorials/how-to-add-a-button-in-your-wordpress-header-menu/

Modifying a Menu Item on a WordPress theme is not too difficult. The basic steps are

  1. Add Menu Item
  2. Add CSS Class to specific menu item
  3. Customize the new CSS class by using the Additional CSS Options

Add Menu Item

Add or customize a menu item by going to Appearance -> Menu

Add a CSS Class to Menu Item

You can add a CSS class to an existing menu item, or you can create a new menu item.

  1. Create Menu Item
  2. Select Screen Options
  3. Enable CSS Classes. (Needed for the next step)
  4. Under the Menu option, set a CSS class. (Name it something unique so it doesn’t interfere with other CSS classes. We’ll configure the CSS in the next step)

Customize CSS

Now we can setup and customize the CSS class by going to Appearance -> Customize

Now find where the “Additional CSS” setting is. If it is not under the main list, try looking under “Advanced”. The Additional CSS editor page should look like the following.

Once there, add all the CSS you want to change color, padding, etc.

You can make it look like a button by adding things like

border-radius: 5px;
padding: 0.5rem;
margin: 0.2rem;

Check out the following link for more info about buttons.

https://www.w3schools.com/csS/css3_buttons.asp

Briefly unavailable for scheduled maintenance. Check back in a minute

Briefly unavailable for scheduled maintenance. Check back in a minute

Looks like you can get the above error sometimes if you close out your tab too quickly, or there is some sort of plugin problem. Looks like you can resolve it by deleting the “.maintenance”

More info here

Reset WordPress admin password in MySQL

Log into MySQL from command line

mysql -u root -p

Select the correct database

USE wordpress_db;

Print current users

SELECT * FROM wp_users;

Should get something similar to the following

mysql> SELECT * FROM wp_users
-> ;
+----+------------+------------------------------------+---------------+---------------------------+----------+---------------------+------------------------------------+-------------+--------------+
| ID | user_login | user_pass | user_nicename | user_email | user_url | user_registered | user_activation_key | user_status | display_name |
+----+------------+------------------------------------+---------------+---------------------------+----------+---------------------+------------------------------------+-------------+--------------+
| 1 | admin | 5f4dcc3b5aa765d61d8327deb882cf99 | admin | bob@incredigeek.com | | 2018-08-09 10:10:42 | | 0 | admin |
| 2 | bob | 210805fb52a13251f4bedc7e725e575a | bob | bob@incredigeek.com | | 2019-11-01 11:31:23 | | 0 | bob smith |
+----+------------+------------------------------------+---------------+---------------------------+----------+---------------------+------------------------------------+-------------+--------------+
3 rows in set (0.00 sec)
mysql>

To update the password use

UPDATE wp_users SET user_pass = MD5('NewPass') WHERE ID=1;

The MD5 hashes the NewPass and adds it to the database. You can print the users again to verify the hash changed.

You should now be able to login using the new password you configure.

How to install WordPress via ssh

Quick look at the commands.  Skip below to view the explanation of the commands

ssh steve@incredigeek.com
cd ~/
wget https://wordpress.org/latest.tar.gz
tar zxvf latest.tar.gz
vi wordpress/wp-config.php   <-- Edit MySQL settings
mv -R wordpress/ /var/www/html/
exit
steve@localhost ~: chrome incredigeek.com/

 

SSH into your webserver

ssh bob@yourserver.com

Download the latest version of WordPress

cd ~/ && wget https://wordpress.org/latest.tar.gz

Extract the WordPress archive

tar zxvf latest.tar.gz

Create MySQL database and user

Refer to here if you want to do it from the command line.  The recommended way is through your web control panel i.e. cPanel, Plesk, EHCP etc.

Edit wp-config.php

Enter in the DB information.

vi wordpress/wp-config.php

Move WordPress files to web directory

mv -R wordpress/* /path/to/webdir

If you want to install WordPress inside a sub directory on your website i.e. instead of going to “example.com” to access your WordPress site, you go to “example.com/wordpress”, then create a sub directory in your root web directory and move the WordPress files there.

Open up a browser and go to your website (example.com) to finish the WordPress installation.

 

How to Restore a WordPress Site from a Backup

You need to

  1. Upload WordPress Backup Files to server
  2. Restore WordPress Backup
  3. Restore Database Backup

If you need to backup your site then you can use this how to here

1. Upload WordPress Backup Files to server

Use your favorite ftp client(FileZilla?) to upload the MySQL database and WordPress files to the server.  If they are already there skip to step 2.

In Linux you can use the ftp or sftp command.

sftp me@myserverip

once you connected you can upload your backups using put.

put wp-backup.tgz

and

put wp-database.sql.gz

 

2. Restore the WordPress Files

This is super easy because all you have to do is untar the files.  Make sure the file is in the directory that you want WordPress in.

tar -zxvf wp-backup.tgz

3. Restore Database Backup

If your MySQL backup is zipped, unzip it.

gunzip wp-database.sql.gz

We need to create a database to import our backup.  You can change wp_database to what ever you want.

mysql -u username -p

mysql> CREATE DATABASE wp_database;

Import database

mysql -u username -p wp_database < wp-database.sql

 

You should now have a fully functioning WordPress site.

 

How to Backup a WordPress Site from the Command Line

There are 2 things we need to do when we backup a WordPress site.

  1. Backup the WordPress files
  2. Backup The WordPress database

Backup the WordPress files

We can backup the files with tar by running the following command.  Replace (/Path/to/wpdir) with the actual path.

#  tar -zcvf wp-backup.tgz /Path/to/wpdir/

This can take awhile depending on how big your site is.

Backup the Database

The following command will backup the WordPress database into a gziped sql file.

mysqldump -u username -p[root_password] database_name > wp-database.sql && gzip wp-database.sql

You can find the MySQL Database, username, and password in the wp-config.php file in the wordpress directory

You should now have two files, wp-backup.tgz and wp-database.sql.qz, you’ll need both of these to restore the backup.