WordPress 4.4 and Twenty Sixteen

I’ve been waiting for this theme for a while. Installed it moments before WordPress 4.4 moved from RC to final.

1. Borders

The first thing I found I didn’t like was the border around the outside. It had to go.

Pop into your favourite CSS Plugin manager and change/add these two rules:

body {
  background-color: inherit;
}

#page.site {
  margin: 0px;
}

Discovering how to remove it was a two step process. Removing the margin from #page.site didn’t remove the entire border, it only removed the left and right side. Which surprised me at first and it took some digging but there’s a ::before snuck in there which manages the top and bottom borders.

the sneaky top and bottom margins
the sneaky top and bottom margins

To easily remove it, I just removed the colour of them, hence the inherit.

Digging around trying to find the top and bottom, I was forced to look at them for a few page reviews, and once they were gone I realised that I liked them. So I then removed the background-color style and brought them back. :)

2. Caption alignment

I don’t know why WordPress has a predilection for choosing to align captions to the left, I much prefer them to be centred. To me, it should be about a bit of symmetry.  So, looking at the image above, it first looked like this:

how the wp-caption-text looked BEFORE unaligned/aligned-left
how the caption looked before…

I’m sorry, that just won’t do.

A quick and dirty fix is to include a text-align: center, like this:

.wp-caption-text {
  text-align: center;
}

3. Green & Amber Screens for <pre>

I’ve been using computers for so long that my first computers used green and amber screens. I remember the old green and amber CRTs we use to have. I actually had an amber one, I liked it, but most people didn’t.

So in doing this post and doing the borders section, I did one of my first usual edits, and that was to turn the <pre> style into something that resembled a green screen. But then as a joke, I made it amber, and find that with this colour scheme, I am preferring it. SO I think it’s here to stay. Regarding the <pre> style, This is what I came up with:

pre {
  background-color: #010;
  color: #3c3;
  font-family: "Courier New", monospace; 
  overflow: auto;
  word-wrap: normal;
  white-space: pre;
}

Changing WordPress username

wordpress profile capture showing the message "can't change username"Have you ever checked your WordPress profile and noticed you can’t change your username?

Did you ever realise that most people choose the same display name as the username, which then gives hackers a legitimate username to try and hack into your site?

Do you use the same username and display name and now want to change your username (because you don’t want to change your display name)?

Then you should change your username.

There are two ways you could do this:-

  1. through WordPress itself:
    • Create a new user with the username (backend name) that you want
    • Login as that user and verify your account
    • Make sure permissions are right between the users (you’ll want the new user to be (super/) admin)
    • Delete the old user and assign all old posts to the new user
  2. through the database:-
    • edit the username for the user in the user table
    • edit the username in the site meta table for super admin (only applicable in a multi site install)

I didn’t do it through WordPress itself, since I do like to play with the database :) But in theory it should work and is the suggested theory on multiple sites.

Let’s break down the second option:

  1. Make a backup of the database
  2. Open the database using your chosen method
    • for me this is to log into my providers cPanel, and select myPHPAdmin
    • go to the users table (not the usermeta table). The table will be called something {DB_Prefix}_users (usually wp_users or wp_x_users in a multisite install where x is the identifier for the site).
    • change the username field to the new desired name
    • when you save the entry you will most likely be kicked out of the backend immediately, simply login with your new username and all is good to go
    • if you do NOT have a MultiSite install, your job is done. If you DO have a multisite install, read on:
  3. still in the database, navigate to the wp_sitemeta table and look for the meta_key: site_admins.
    • There will be an entry like: <pre>a:1:{i:0;s:4:”john”;}</pre> and change it to the username you created in step 2. You will also need to change the “S:n” (in this case “s:4”) to a new value depending on the length of your username. So you’ll note for “john” it’s 4. For “john-you-won’t-guess-this-827646″ you would make the entry:<pre>a:1:{i:0;s:31:”john-you-wont-guess-this-827646”;}</pre>. For reference, the “i:0” is Index 0. If you have multiple users here, this line will have multiple indexes with each one serialised onto the line and having their own section. Make sure you change the correct one(s).

Not doing this final step will not kick you from the individual site admins, but it will prevent you from getting to the Network Settings area to add plugins, themes and do other “network” maintenance things (like adding or removing sites amongst others).

I’ll let you know now, I learned about step 3 the hard way after being locked out from the Network Settings area after changing my main username.

I could do everything an admin could do for their site, I just could no longer administer the network.

Searching the net found this entry on WordPress.org and solved my problem.

Youtube embedded videos in WordPress not working

You’ll notice above that there is a youtube URL on the first line… it hasn’t embedded within the post.

UPDATE 2015-12-10: it’s working now, is it a WordPress 4.4 thing? I have disabled a LOT of plugins for the moment, I’ll come back and revisit this in the next couple of days. I have spent many hours working on this problem over the last few months and having just found I’ve had other issues, I’ll revisit this again

Embed the URL without embed tags
Embed the URL without embed tags

Also, I have just learned today that the youtube style of embedding without embed tags have been extended in WordPress 4.4 to include URLs to your own WordPress site (and possibly others).

Are you finding your http://youtu.be/{videocode} youtube links not embedding correctly or working in WordPress?

The correct format for the link is any one of the following:

http://youtu.be/{videocode}
http://youtube.com/watch?v={videocode}
[ embed]http://youtu.be/{videocode}[/embed ]

(there is a space before the embed in the above one to have it display correctly)

There are three things to watch out for to ensure this works. And if you do each of these, then you don’t need to use the [ embed ] code you see in the third example above. They are:

  1. Ensure the URL is on it’s own line
  2. Ensure you use HTTP in lieu of HTTPS (*1)
  3. Ensure the link does NOT appear on the first DISPLAYED line of the content

*1 : this is not a big one, since it seems most of the time it works, but for some reason it didn’t when I used it on this particular occasion.

I say DISPLAYED because in an effort to fix this, I tried putting a blank line for the first line. The problem persisted. It also didn’t help to include just a full-stop (period) there either.

I do believe it could also be theme related as this theme does not use the different post type options that is present in the newer themes. And from what I did find elsewhere, selecting different options in that meta-box can alter this behaviour. I will probably be changing themes in the coming months as I work further on my own custom theme, but for the time being if I want it to appear on the first line, I will use the appropriate [ embed ] code above (with the space removed!). This was not a problem I found documented anywhere else, so hopefully you have found this useful!

WordPress media library limited to 10MB

Screenshot 2015-09-14 11.23.102
I think I’m a little over my quota!

Have you ever noticed this in your blog? It’s never been there before, but it appeared in the last day or two. At the time I wasn’t sure how or why. It’s my blog hosted on one of my web hosting accounts, and I have no shortage of space. So why was I getting this warning?

Screenshot 2015-09-14 11.35.24Worse yet, I went to add a photo, and this happened. That’s when I realised the quota was real!

My first question is, what dickhead gave me such a quota!

My first action was to work out where it was imposed.

Then I found who the right royal dick was. It was yours truly!

I’ve been doing too much playing in the back end and I at some point, and for some unknown reason, have turned it on.

I’m running WordPress Multisite and it’s a setting hidden in the Network Settings.

To navigate to it, click on My Sites in the top left corner, and select Network Admin. Then from the next menu select Settings.

secret hiding place for the 10MB upload quota
this little setting on the right… Make sure you turn it off! :)

And that’s it! Once, you clear that little baby, you’ll be able to upload to your little hearts content.

UPDATE: It looks like I wasn’t the only one who’s ever done this! 

WordPress MultiSite & sunrise.php

Are you getting the above error message as well?

After doing a fresh install and enabling multi-sites I couldn’t see the Domain Mapping and Domains sub-menu options under Network Admin / Settings.

I loaded up my trusty editor and confirmed

define('SUNRISE', 'on' );

was in fact in the file. It was slightly higher than where it said, it’s not important, but I moved it anyway, and I still got the error.

I checked and sunrise.php was in fact in the correct location under /home/public_html/wp-content/sunrise.php

So how did I fix it?

The problem was, it was the incorrect (read:old??) sunrise.php file!

Copy the correct one from:

/home/public_html/wp-content/plugins/wordpress-mu-domain-mapping/sunrise.php

and replace the previous one, and reload your admin page. You will now see the welcoming domains page :D

If you want to find out more as to why it happened, and how it is that my sunrise.php got “moved” or “re-moved”, it was due to a conflict by domain mapping plugins. I’ll be blogged about it in the near future and it will appear here (currently in draft and not published).

WordPress MU Domain Mapping missing

Screenshot 2014-12-02 05.39.14

Screenshot 2014-12-02 05.55.36
Domain Mapping and Domain options returned

When upgrading from version 0.5.4.3 to 0.5.4.4 and returning to the network admin site, I had lost all access to the domain management tools. The options normally reside under Settings (right) were no longer there. A quick check of some domains I have setup through domain mapping confirmed that it was still working, ie things were being redirected, however I couldn’t check, change, add or remove any mappings. I couldn’t see them at all.

I went into the Network Admin plugins page to find the plugin hadn’t re-enabled itself after the update. As far as I know, this is the first time any plugin has failed to reactivate. If this was by design, a few moments of stress would have been alleviated if some user warning could have been provided.

After re-enabling the plugin, all domain maps were right where they should have been.

How to change a multisite primary domain

WORDPRESS-black-ink-grunge-stamp-textures-icon-social-media-logos-wordpressIf you want to change the primary domain of your WordPress multisite installation, there are 5 values to change. There is no need to perform a database dump. This is actually frowned upon, as WordPress stores serialized data in the database, and altering it can cause corruption. Here is a list of the 5 main tables and options that need to be changed (note that we’re assuming your table prefix is “wp_”. If you’re using a different table prefix, replace “wp_” in the following table names with your prefix):

  • wp_options: options named “siteurl” and “home”
  • wp_site
  • wp_sitemeta: the option named “siteurl”
  • wp_blogs: any entries in the “domains” column that have the old domain name
  • wp_#_options: Each sub-site will have sets of tables that correspond to the blog_id in the wp_blogs table. You need to go to the wp_#_options table, where # corresponds to the blog_id, and update the “siteurl” and “home” settings in that table.

Continue reading “How to change a multisite primary domain”

Moving posts between blogs

I have a multisite setup running here but I largely use one blog for just about everything, ranging from (things like this) WordPress, to applications and shortcuts, through to personal posts about travel, and my family and children.

In the multisite setup I have several blogs. Mostly the are concepts or ideas that never really took off (like dav3 on wordpress).

It has now got to the stage where I want to merge a few of these together, and maybe separate out some others (more about the merging all the blogs into just two or three—probably two).

I’ve been thinking in my head how I would achieve this and finally today I did a google search on it. The very first post came up with what sounds to be a solution and breaks it into three parts, and I’m going to add a fourth.

  1. On blog 1. Export the posts.
  2. On blog 2. Import the posts.
  3. On blog 1. Create permanent redirects for the pages you now have on blog 2.
  4. On blog 1. Delete the posts you no longer want there.

You probably didn’t even know you could do this. I know I didn’t. I know that I’d seen the Tools before, but I’d never really given it consideration. Until I read Andreas Rennick’s post over on WordPress.org.

I did add step 3 just on the supposition that someone finds your post to the old blog somewhere but can no longer find it because you have deleted it. Setting up a quick redirect to handle such a scenario will 1) get them to the post/place they need, 2) allow them to find more relevant stuff in your new blog, and 3) help to update the search engine that got them there in the first place.

Thanks Andrea for making the simple so obvious.

I’ll post again, or update this post when I do it myself with how (easily?) it went :)

 

wordpress 3.6, blockui.js problem and sidebar login

I upgraded to WordPress 3.6 the other day and immediately got the flowing error:

“error 3.6 blockUI requires jQuery v1.2.3 or later!”

Actually, that’s not the exact error I got, the exact error included version numbers of the current and the required versions. The odd thing being the current version was higher than the required version, but computers (and how they read numbers vs strings) got it all wrong.

I have a ton of plugins installed and took a stab in the dark at sidebar login (it’s one of the few that I use across multiple sites).

It was updating this plugin (for me) that resolved the issue