Changing your theme

Sometimes you just want to make smaller changes to your theme, it might be a logo that should be different, or a background color. Some themes doesn’t allow you to do this under Appearance – Customize, only in their PRO version. You could do it by altering the themes files, but if you are runnuing a multisite wordpress, your changes might affect several sites.

Instead you can use the Simple Custom CSS plugin, which allows you to write your own css that will override the ones from the theme. Here is an example:

.left_container {
background:none !important;
div { background: red; 
}
}
img#site-title {
content:url("http://photohelge.w.uib.no/files/2017/09/logo-helge-3.gif") !important;
height: 25%;
width: 25%;
}

Where I have changed a background color for class=left_container to none, and also chosen my own image for the logo.

different-logo-than-default-theme-logo

Rewriterule HTTP_HOST in Apache

We had to rewrite some specific domain names in our WordPress multisite.

Most of our domains are on this form: something.w.uib.no

In our case that is nice, because we also have a valid ssl certificate which supports *.w.uib.no.

But in addition we have other domain names on the form: something.uib.no

which we don’t have a valid ssl cerificate. When a wordpress administrator tries to log in to:

* http://something.uib.no/wp-login

he/she is met with a scary ssl certificate warning. (Because we don’t have SSL certificates for these domain-names)

Our solution was to redirect this request with some Apache rewrite rules:

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/wp-login\.php [or]
Rewritecond %{REQUEST_URI} ^/wp-admin$
RewriteCond %{HTTP_HOST} !^(([^.])+\.b\.uib\.no)$
RewriteCond %{HTTP_HOST} ^([a-z.]+)?uib\.no$ [NC]
RewriteRule .? https://%1w.uib.no%{REQUEST_URI} [R=301,L]

which says something like:
If REQUEST_URI starts with wp-login.php OR wp-admin, AND the HTTP_HOST (domainname) is NOT LIKE something.w.uib.no AND HTTP_HOST IS something.uib.no, THEN
rewrite the whole thing to a new URL with  301 (permanently moved). The %1, which is the match in the regular expression above is part of the new URL.

In this way we could make sure that the users of wordpress instances with http://something.uib.no, would be redirected to a proper domain name, and thus with a valid SSL certificate.

See also:
http://www.webforgers.net/mod-rewrite/mod-rewrite-syntax.php
http://support.hostgator.com/articles/cpanel/articles/getting-started/general-help/apache-mod_rewrite-and-examples
http://httpd.apache.org/docs/current/mod/mod_rewrite.html (se: RewriteCond backreferences)

You might ask “Why not just order and install the SSL certificates as needed?”.

The answer is that ordering SSL certificates is a very manual process and takes a lot of administration and time, involving a lot of people. We want to avoid such and make things as simple as possible.

Create a PDF book of your WordPress blog

If you are thinking of creating a PDF file from all your posts in your WordPress blog, you can try this:

First, use the Tools – Export to create a xml file. Save it.

Then go to: http://blogbooker.com/wordpress.php

Upload your xml file, and Blogbooker will create it, and you can download the result afterwards.

Here is some posts exported to a pdf book from my Blog: blogbooker-book

Make a “copy” of an existing blog

Someone asked me how they could make a “copy” of their existing blog. This is easy if you use WordPress export and import.
Here at University of Bergen, people can create their own blogs at:
https://w.uib.no/sso/

After creating the new blog, then posts, pages and other stuff can be exportet from the old one under Tools – Export.

Save the exported XML file somewhere on your computer.

Next thing is to activate the WordPress Importer plugin in the new blog that you just created. It’s done under Dashboard – Plugins (search for keyword Import).

Then, import the xml file under Tools – Import

To make it maybe clearer, I also made this video:

 

Facebook wall in WordPress

I had some issue to get this one working, but after some tips from Takanudo, see comments below, it is now working like charm 🙂

If you get:
“Facebook-The global ID is not allowed. Please use the application specific ID instead”

you should see the post comment’s below from Takanudo.

I needed to display recent news from a Facebook group in a WordPress context. There are many Facebooks plugins, I tried this one:

JSL3 Facebook Wall Feed

I needed:

  • Facebook id
  • AppID
  • AppSecret

Facebook id: Log in to your Facebook page, go to settings. There you will find the code:

facebookid

Next is to create an app at Facebook. Go to: https://developers.facebook.com/

Logg in, on the menu, click on Apps, Create a New App:

facebookapp

Then collect your App ID and App Secret:

Then add Platform Website:

facebook add plattform facebook platform

Then install the plugin JSL3 Facebook Wall Feed, activate it, and go to JSL3 Facebook Wall Feed settings. Put the Facebook ID, App ID and App Secret.

jsl3 facebook wall feed settings

Save settings.

Finally, add your Wall Feed in a Widget:

in widget

Result:

facebookstatus