Mein Kompendium: mp-wp

This was originally posted March 24, 2018 before this blogs' temporary death on old VPS. Since then, hanbot has released a MP-WP genesis, and esthlos also posted a handy guide on erecting mp-wp on gentoo (which I consulted while re-erecting this blog on the pizarro rockchip).

This is my own compendium of fragmented notes I gathered together while erecting my own copy mp-wp. I started off by using hanbot's guide (archived), and as such I will not re-cover things already covered there. This is meant to be supplemental, ya dig?
---
Creating a mysql database, user, and assigning privileges:
This is assuming you already have mysql installed on the target box1 . First, log into mysql as root and take a look at what databases you currently have:
> mysql -u root -p
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.05 sec)
Now create a database and name it whatever you like:
mysql> CREATE DATABASE [Your database name];
Query OK, 1 row affected (0.00 sec)
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| [Your database name] |
| mysql |
| performance_schema |
+--------------------+
4 rows in set (0.00 sec)
Make that user!
mysql> CREATE USER '[Your user name]'@'localhost' IDENTIFIED BY '[Your password]';
Query OK, 0 rows affected (0.00 sec)
You can validate that it was created by checking the mysql.user table:
mysql> SELECT User FROM mysql.user;
+------------------+
| User |
+------------------+
| root |
| [Your user name] |
+------------------+
2 rows in set (0.00 sec)
Grant all privileges for your new database to your new user:
mysql> GRANT ALL PRIVILEGES ON [Your database name].* TO '[Your user name]'@'localhost' IDENTIFIED BY '[Your password]';
Query OK, 0 rows affected (0.05 sec)
Finally, flush privileges and exit:
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> EXIT;
Bye
Later, you will go through the install process2 and mp-wp will create all the tables in [Your database]. If you're like me, you'll want to see these newly created tables. Head back to mysql, and:
mysql> USE [Your database];
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> SHOW tables;
+-------------------------------------+
| Tables_in_[Your database] |
+-------------------------------------+
| [Your goddamned prefix]comments |
| [Your goddamned prefix]links |
| [Your goddamned prefix]options |
| [Your goddamned prefix]postmeta |
| [Your goddamned prefix]posts |
| [Your goddamned prefix]term_relationships |
| [Your goddamned prefix]term_taxonomy |
| [Your goddamned prefix]terms |
| [Your goddamned prefix]usermeta |
| [Your goddamned prefix]users |
+-------------------------------------+
10 rows in set (0.00 sec)
---
Configuring blog to use permalinks (Optional):
Disclaimer: I've only used apache thus far in my hackin' career, so no idea how this works with, say, nginx. This may or may not be of use to you.
To set your blog to use permalinks3, point yer browser to "[Your blog root url]/wp-admin/", log in, select the desired settings, and then make note of the code presented at the bottom of the page. Will look similar to the following:

RewriteEngine On
RewriteBase /[Your blog root dir]/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /[Your blog root dir]/index.php [L]

Then you must create a .htaccess file in /var/www/[Your blog path] with the code mp-wp produced contained within.
I also had to4 enable apache2's mod_rewrite module and edit the config file in /etc/apache2/sites-available/ to AllowOverride for my blog directory.
Of course, these steps will vary depending on your system and root blog directory, so some research may be required.
Don't forget to restart apache once done configurin'!
---
Spiffy js-text selector:
For that nifty text-selection thing, first read this:
http://trilema.com/2015/that-spiffy-selection-thing/
Note: Remember to take your permalinks5 into account when specifying your path
Note2: I'm using my own 'forked' version of the "default" theme. This worked for me out-of-the-box, but if your theme has a different DOM than the "default", then you might find useful these tips spyked laid out in the logs
---
"Default" theme sidebar:
When hacking off of the "default" theme6 you will have to add7 "<?php get_sidebar(); ?>" to single.php to get the sidebar to appear on individual posts.
Note that some playing around with the css will most likely be necessary for things to not look retarded.
---
Custom rss feed preview:
This may be of no use to you if your entire site will be devoted to your blog. However, I wanted to shove my blog down a level in the hierarchy, and thus wanted my 'homepage' to remain 100% non-wordpress. While that part is easy enough, I still wanted to preview my posts on that homepage.
Luckily, I found a php RSS feed displayer-isor in the wild. Very short and easy to read and edit to your preferences (e.g. I removed the bit that previews the entire post); you can find the original here (archived).
  1. If you don't, it should not be difficult finding the proper install documentation for your system. []
  2. /wp-admin/install.php []
  3. e.g. "www.[Your blog root url]/2018/01/your-post-title" instead of "www.[Your blog root url]/?p=1234" []
  4. On Debian 7 []
  5. if you are using them []
  6. vs "classic" []
  7. take a look at page.php for an idea of where exactly []

Leave a Reply