WordPress Tips and Hints

Aus Wiki

Change language to german

  1. Download language files from WordPress Germany
  2. create directory language under wordpress/wp-content
  3. copy unzipped files into this directory
  4. edit wordpress/wp-config.php: Enter bold text (according to copied files) define ("WPLANG", "de_DE");

Plugins

  • Theming
    • See [1]
    • When using Agama custom theme and moving your homepage to https Chrome is complaining that the site is insecure since some resources are loaded via http instead of https.
This can be fixed by:
  • Open dev tools in Chrome, reload page and seek the resources loaded via http. Typically these will be theme resources like main icon etc.
  • Open Hostpoint, go to your database and open phpmyadmin; go to configurations table and select Agama configuration. Copy old value for backup!
  • Here you can find something like "agama_logo";s:69:"http://. Update to https and increment the value to s:70 then press 'OK'. If you missed updating the value the cell content gets reset by Agama after site reload!
  • Akismet
    • already contained, but not activated.
  • Events Calendar
  • This plugin allows to have a calendar based blog.
  • Installation
Download from [2] and install as described.
  • Localize the calendar by downloading the localization files from here and upload the po and mo file to WordPress/wp-content/plugins/calendar.
  • Backup
    • Use plugin 'WP-DBManager' to backup all database content.
    • Backup theme, icons, plugins etc. with: [3]. Do mind that you need to install this plugin by yourself (strangely...).
  • Localization
  • See [4]
  • See for localizing widgets here and here. Example: [:en]Pages[:de]Seiten

Bugfixes

Sidney Theme and Wordpress Photo Album

This issue is described here but no solution presented: https://wordpress.org/support/topic/call-to-action-button-not-working-3/ I found out that it is a combination of the WordPress Photo Album and the Sidney theme. The WPPA-plugin seems to be loaded very generically and thus the following window.onpopstate-function is registered on the hero-part as well:

 window.onpopstate=function(e){

There in the last line the whole page is just reloaded what we do not want here: It should just smoothly scroll down. Thus, in the file wppa-all.js I just commented out the last

 document.location.reload()

call..

Cloning a WordPress instance

(When I changed my company's name I had to copy one WordPress instance to another.) I managed to clone one WordPress instance in the following sequence:

  1. Install plugin XCloner on WordPress instance to clone. Set up your preferred password. Configure backup-directory. (I created the server-locally directory by means of FTP.) Create directory '<wp-installation>/administrator/backups' which is used as a temporary directory.
  2. Create backup, e.g. <old site>/xcloner-backup/xy.tar
  3. Then I installed a new WordPress instance. (HostPoint Control Panel, installation directory <new site>/wp...) Write down DB-server, DB-username/-password. Alternatively (or even better) just create a new DB instance.
  4. Restore the cloned WordPress instance:
    1. copy tar file to e.g. <new site>/xclone-backup
    2. copy <old site>/<WordPress-dir>/wp-content/plugins/xcloner-backup-and-restore/restore/XCloner.php and TAR.php to <new site>/xclone-backup.
    3. Open browser with <new site>/xcloner-backup/XCloner.php
    4. Config all database and server settings, then execute the installation. Skip failing database operations..., refresh browser if things seem not to go on any further...
    5. Edit <new site/<WordPress-dir>/wp-config.php to configure new database settings.
    6. Open browser to new WordPress instance.
    7. Now you have to:
      1. Reactivate and reconfigure all plugins (all paths must be updated)
      2. Reconfigure Theme, Widgets etc.
      3. Update all referenced media on every page and post: All paths must be updated! (Maybe following plugin could be helpful: Change-WP-URL.)
      4. Optional: Copy <new-site>/<wp-dir>/index.php to <new-site>/index.php so that WordPress instance can be called up with <new site> (without /wp)
  5. Remove the directories <old site>/xcloner-backup and <new site>/xcloner-backup.

Forward to other site with timeout

Source: Htmlbasix In WordPress go to 'Appearance', 'Editor' then select 'Header (Header.php)' and enter the head-code within the <head>-tag. E.g.:

 <head>
 <META HTTP-EQUIV=Refresh CONTENT="5; URL=http://neshendra.com"> 

and enter a notable message on the frontpage. (see next entry)

Show a floating message in the WordPress installation

See Yahoo1 and Yahoo2 Log into WordPress and go to 'Appearance', 'Editor', select 'Header (Header.php)' and enter the following code at the end:

 <div class="customScroll">

<h1>necetra.ch ist nach neshendra.ch gezügelt! <h2>Sie werden automatisch weitergeleitet. <h1>www.necetra.com has been moved to neshendra.com! <h2>You will be forwarded in any second.

 <style>
 div.customScroll {
   z-index:1000;
   position:absolute; 
   top:40px; 
   margin-left:100px; 
 /*  left:50%; */
   overflow:auto; 
   width:80%; /*150px; */
 /*  height:120px; */
   border:10px 
   lightblue solid!important;
   background:#000;
   color:white;
   text-align:center;
   opacity:0.80;
   -moz-opacity:0.80;
   filter:alpha(opacity=80);
 }
 </style>

CSS

Favicon

see | WordPress Creating a favicon

  1. Create favicon using e.g. | http://www.favicon.co.uk/, normally a image sized 16px x 16px
  2. Copy favicon.ico to <host>/WordPress/wp-content/themes/<theme, e.g.mystique>
  3. (If needed) clear the local browser cache, see Firefox_Tips_and_Hints#Clearing the favicons

Links

Here some links which helped me to solve different important points:


Missing fonts / resources

If a font or another resource does not appear properly check the console for an error like this:

 Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

In this case extend the file .htaccess by following line:

 Header add Access-Control-Allow-Origin "*"

See here.

Create new WordPress-Website and then replace instances

  • Create new WordPress instance on a sub-domain
  • To replace the top-domain go on like following description: [6]
  • In my case I was not able to do Step 9 (upload folder)
  • Additionally I had to update the 'Document Root' on Hostpoint's Websites page. After the change I had to wait aprox. 15 minutes until cache got invalid.
  • Additionally I had to:
    • in WordPress, Elementor, Tools, Replace URLs: replaced old URL by new
    • updated all images in Design, Customizer
    • gone through all pages and updated the resources therein