Changing to navigation by category in single.php

Twenty Seventeen header

The default for WordPress is to have the next/previous navigation links go through time not category. You can change this instead to navigation by category in single.php, the file that controls how a post is displayed.

For instance, if you do five different posts in a row

  1. Garlic
  2. Computers
  3. Avacado
  4. Linux
  5. Tomatoes

And you have two categories such as food and computing. When you are on the page about Avacado your next and previous links are to Computers and Linux which doesn’t make much sense if you came to the site in order to look at food.

What would make more sense is to have the next/previous links on the Avacado to be Garlic and Tomatoes.

(Also see how to change where the links are in a post using single.php here)

How to change to navigation by category in single.php

The first step in changing to After changing to navigation by category in single.php is to create a child theme and place a copy of your themes single.php file inside it. I use Twenty Seventeen as my theme so I will be using that code. It is also a good idea to make one change and then test your site so you can easily revert if something goes wrong.

The relevant code begins with the_post_navigation( array( and continues though prev_text and its options and next_text and it’s options until closing with a ) );. I have highlighted that below.

Before changing to navigation by category in single.php

All you have to do is add a 'in_same_term' => 'true', statement before the closing  ) );. I have highlighted that  below. That’s it.

After changing to navigation by category in single.php

Now when you look at the Avacado post the next and previous posts should be through time and category instead of just time.

Changing where the navigation is placed in Twenty Seventeen

Twenty Seventeen header

I has annoyed me for a while now that the Twenty Seventeen theme places the next/previous links at the bottom of the page under the comments. This stops people being able to easily see the next and previous articles, especially if there are comments.


Twenty Seventeen - Navigation2


Changing where the navigation is placed in Twenty Seventeen

Luckily it turns out they are quite simple to move. There is a file in the Twenty Seventeen theme called single.php that directs where things are on your post page. In that file there is this block of code.


Twenty Seventeen navigation code

 


Which looks terribly confusing but all it really says is run the next and previous post links and format them with a post title and an arrow. It looks pretty good and you don’t have to change the code at all. Just copy and paste it into a different part of the file.

(You should only do this in a child theme. If you don’t know what one is go here!)

So, having created your single.php file in your child theme, open it in a text editor and paste in the code from your parent theme. Identify the navigation block ( as you are better to copy and paste from your own theme in case there are problems with the code block above ) and copy it and paste it in a different place. Put a comment in to show what you have done above where you have pasted it. Comments start with //.

I left mine at the base of the comments and then placed a copy of the code under get_template_part( 'template-parts/post/content', get_post_format() ); which means there will be another previous/next link showing at the end of my post above the comments.


Twenty Seventeen - Navigation


KDE neon Google Drive setup

Google Drive

Setting up Google Drive access in KDE neon is very simple.

Installing Google Drive

Open Konsole and type,

sudo apt-get install kio-gdrive

Then, once it has installed,  open your menu and go to System Settings. You should find a new feature under Personalisation called Online Accounts. Clicking the plus sign in this will allow you to enter your Google credentials and password and authorise KDE to access your Google Drive.

After setup a window should open showing your files. I bookmarked it by highlighting and dragging the address left into my Places. If you forget to do that you can always access it by typing,

gdrive:/<insert your email address here>/

into the address bar of Dolphin.

If you are unable to find your photos on the Drive you will need to adjust some settings in the Drive so that it backs up your photos.  If you are unable to see photos you have uploaded to the Drive then you need to activate it in Google Photos.

KDE neon – Post installation review

KDE neon default desktop

KDE neon is not so much a distribution as a rapidly updated version of Ubuntu 16.04 with KDE as the desktop and it isn’t bad at all. I haven’t had much luck with KDE for a while, Kubuntu annoyed me and I just couldn’t seem to get my first distribution openSUSE to work properly. So far it is going very well though so I thought I would give a run through of my basic post installation to help others.

I say post installation as I clicked;

  • Download updates while installing neon
  • Install third-party software for graphics and Wi-Fi hardware, Flash, MP3 and other media

during install which made things a lot easier.

There are a couple of things I have found annoying. The KDE software installer, Discover,  isn’t the greatest. It doesn’t recognise some things on search and you have to swap back to command line install sometimes but that isn’t much of a chore really. You only have to install once after all.

KDE neon – Post installation

Update

The first thing to do is update just to make sure you have everything. KDE’s terminal is called Konsole and the easiest way to find it is to click on the menu of the bottom left and type konsole. It is generally a good idea to right click on the icon and choose add to favourites as well. This makes it quicker to find.

sudo apt update

KDE neon update

sudo apt upgrade

KDE neon upgrade

Widgets

While that is updating I usually arrange my widgets on the desktop. Widgets are handy little programs that can be placed on the Plasma Desktop.

In a default install the KDE neons Plasma Desktop you can choose them by placing your mouse in the top left corner of the screen, clicking once for the dropdown and then again on add widgets.

Click on and drag any widget you want onto the desktop. I like the Folder View, Trash and Network Monitor widgets. There are many others though.

After choosing and arranging your widgets to your liking click on the dropdown again and choose lock widgets to lock them in place.

Applications

KDE neon comes with few applications installed, which I really like. A lot of desktops are too cluttered with everything you might want instead of everything you actually needed.

I installed; Amarok, Backintime, Calligra, Chrome, Digikam, GIMP, Kontact, Krita and Netbeans which fulfilled my needs.

Of these only Chrome and GIMP aren’t KDE applications. And GIMP I only installed as I am used to it. Krita probably would have worked fine. It doesn’t actually matter if you mix and match KDE and Gnome (etc) but I was trying for a KDE desktop.

Most of them I installed on Discover, the KDE software manager, but some of them wouldn’t turn upon it so had to install them via Konsole using,

sudo apt install <insert software here>

Discover still needs some work I think……

Filesharing

KDE neon is great for setting up filesharing. The only hold up was again Discover. In the end I used Konsole again.

sudo apt-get install samba kdenetwork-filesharing

After installing you can right click on a folder and choose “Properties” and there will be a “Sharing” tab to set up sharing that folder.

Miscellaneous

Although all the codecs I need were installed by selecting “Install third-party software for graphics and Wi-Fi hardware, Flash, MP3 and other media” I installed msttcorefonts with Konsole in order to get fonts like Arial.

sudo apt install msttcorefonts

Accept the licenses.

KDE neon review

I have been using it as my Desktop for four days now and it is fantastic. I had forgotten who easy and configurable KDE is. There have been no crashes. Everything is fairly rock solid. I recommend it.

Installing Discord on Linux Lite 3.4

Discord logo

Discord is a voice and text chat application aimed at gamers but can be used by anyone. Is is currently available on Firefox, Opera, Chrome, Android, iPhone, Windows, OSX, and Linux….Basically everywhere. There is also a tutorial for installing on Fedora 25 here.

Installing Discord on Linux Lite 3.4 is easy

  1. Go to this webpage, click on ‘Download for Linux’ and then ‘deb’ to download the installer.
  2. Go to the folder it downloaded into, right click and select ‘Open Terminal Here’.
  3. In the terminal type sudo dpkg -i discord-0.0.1.deb (replacing discord-0.0.1.deb with the name of the file you downloaded).
  4. Press enter and type your administrative password.
  5. Wait for it to install and then close the terminal.
  6. Open the ‘Menu’ on the left base of screen and type ‘discord’, press enter and it will start.

On my system it seemed to use a lot of resources on first start but after updating itself it worked just fine.

It was created for gamers but is also used by Internet Party NZ for many of it’s internal meetings, voice chat, and group sessions. It allows you to create personal, public and private chat rooms. In general it is much loved.

 

Failed to retrieve share list from server

Failed to retrieve share list from server

This has bugged me for a while as I fixed it and then it reoccurred probably after Windows updated. The problem was that I was unable to connect Ubuntu 16.04 to my Windows 7 box. It wasn’t the firewalls and none of the usual fixes seemed to work until I ran into this page. All I would get was and error saying ‘Failed to retrieve share list from server: Connection timed out’ which wasn’t much help.

Everything was set up as normal and I could connect to other shares,  just not the Windows 7 one.

I ran through the steps here and they didn’t work and although there is a reference to ‘Unable to mount location: Failed to retrieve share list from server’ the linked Microsoft fix doesn’t specify Windows 7.

Using smbclient -L //insert-ip-here -u% would give me a ‘protocol negotiation failed: ERRDOS:ERRnomem’ error so using that I managed to track down the referenced page with the fix. One minor change though. I didn’t have to do the last two commands.

The ‘Failed to retrieve share list from server’ fix quoted from Froebe

The issue is the LanmanServer service runs out of memory. We need to boost that up:

On your Windows machine, fire up regedit (Start -> regedit) modify the following registry keys:

“HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\LargeSystemCache” from 0 to 1

“HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\Size” from 1 to 3

The problem seems to manifest itself more frequently if you use your Windows box as a file server or a media server. If you can, restart the Windows box. If for some reason you can’t (e.g. your significant other is watching a video on the tv streaming from your Windows box), then you can do effectively the same by restarting the following services:

(Start -> cmd.exe) as administrator
net stop LanmanServer /y
net start LanmanServer
net start Browser
net start HomeGroupListener

Failed to retrieve share list from server solved!

 

 

Webslice adds Lets Encrypt across the board!

Lets Encrypt logo

I was playing around with one of my sites the other day and I realised it was running under https:// which was strange because I never bought a certificate or set it up.

After a bit of playing around it appeared that two other sites worked under https:// as well. None of which were configured by me. All were running WordPress. At this point I thought they had buggered up a setting so I raised a support ticket with my hosting provider Webslice.

The quick reply was,”We are offering free Let’s encrypted SSL for all the domains now.”

Lets Encrypt

For those of you who don’t know what Lets Encrypt is then its best to start with SSL. SSL is the encryption that protects your data on websites such as banks and Facebook. Anywhere where you login with a password should be encrypted otherwise your login and password just got sent and anyone in the middle of you and the website can read it.

This used to rely on certificates that were provided by trusted certificate authorities such as GlobalSign, Comodo and Symantec. The problem was, this was expensive. I saw a price yesterday of $150NZ for a two year certificate for one domain.

In comes Lets Encrypt. They “give people the digital certificates they need in order to enable HTTPS (SSL/TLS) for websites, for free, in the most user-friendly way we can. We do this because we want to create a more secure and privacy-respecting Web.”

And they recently issued their 100,000,000th certificate.

What this means is that now everybody can be encrypted using a trusted provider that is free. Our data just got safer. Our privacy just got private. It also means that hosting companies can roll out free SSL across their infrastructure which is exactly what Webslice have done.

Lets Encrypt logo
The Lets Encrypt logo is a trademark of the Internet Security Research Group. All rights reserved.

 

If you are using WordPress you may need to make a couple of changes.

Convert and split APE into FLAC using a CUE file

If you need to convert an APE file into a FLAC file then that is easy. It also turns out it is easy to split the APE file into different FLAC tracks using a CUE file.

Flacon

Flacon is an audio file encoder that extracts individual tracks from one big audio file and separates them into different tracks. It can also convert them in the process.

Flacon is available for many Linux distributions and can be installed on Fedora 25 with an easy.

sudo dnf install flacon

To convert APE files you will need also to install mac from rpmfusion-nonfree in order to read the files.

sudo dnf install mac

Simply select the destination directory, the pattern you want your files to be renamed as, what format you want them converted to and whether you want to apply replaygain. Then convert. It takes a surprisingly small amount of time.

Flacon converting ape files to flac

Install Discord on Fedora 25

Discord logo

Discord is a voice and text chat application aimed at gamers but can be used by anyone. Is is currently available on Firefox, Opera, Chrome, Android, iPhone, Windows, OSX, and Linux….Basically everywhere. Installing Discord on Fedora 25 is easy.

Open a terminal and enable the copr repository.

sudo dnf copr enable vishalv/discord-canary

Then install with this command (You will have to accept the copr GPG key in order to install).

sudo dnf install discord-canary

It does seem to use a lot of resources on first start but after updating itself it should work just fine.

 

Not installing Discord on Fedora 25?

You can find a install guide for Discord here for Linux lite 3.4.

Discord on Fedora 25,

Gnome Online Accounts – Credentials have expired

Credentials have expired

If you are having trouble with Gnome Online Accounts not logging into Google make sure you are fully updated and try again. Especially if you are getting the error “Credentials have expired”. If that doesn’t work, then open a terminal and try,

pgrep goa-daemon | xargs kill -9

This will kill the Gnome Online Accounts daemon which will then automatically re-spawn. Worked for me!

Credentials have expired

What if the Credentials have expired fix doesn’t work?

Of course, if it doesn’t work for you you might have a different problem. I would suggest searching the Gnome Online Accounts mailing list here or asking them in their IRC if you aren’t able to solve it on Google.