WordPress This and That
Erstellt: | Aktualisiert:Most of this information is from around 2013 and I just collected the stuff as a kind of reference if I need it in the future.
Basically I am using WordPress over here just to see how it works. There are too many people using it too ignore it ;)
The installation itself works like a charm and in this environment is it combined with Varnish to speed up things a bit and MariaDB to get over mySQL.
Varnish itself wouldn’t be required for the 2 visitors per day but it sounds like a good concept and when starting to test WordPress I decided to test this one as well.
How to display the posts on a static page?
This was one of the first questions and finally I figured out that the configuration is done at Settings > Reading
at the Posts Page
dropdown.
How to define the display order of static pages?
Honestly said this was the very first question and it is pretty simple (even not intuitive). The settings is done on the page at the Page Attributes
in the field Order
. I used 10,20,30 for my three pages so there is room left to fill in others.
SEO for WordPress Links with Permalink
Having properly named links is a great thing to be found in search engines. Working with WordPress 3.6 this is done pretty easy with PermaLinks.
Configuration is done at Settings > Permalink and allows to define how the links should look like. Beside various time variables the category and topic are the most valuable ones:
Settings: Custom Structure: xxx/%category%_%postname%
After setting the configuration the .htaccess files needs to be updated as well (if not done automatically). In this case we go for .htaccess of:
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]</pre>
Basic WordPress Theme Manipulation
A couple of theme stuff I did at the beginning.
Theme related information can be found in the folder /wp-content/themes/ and in my case at /wp-content/themes/twentythirteen.
Get rid of the footer
Well, WordPress looks really great and they should get their credits (here we go: CREDITS for WORDPRESS) but usually it is way too much in every footer. So in my case I just removed a part of footer.php.
Extending WordPress Functions
WordPress allows to extent functionality by using the /wp-content/themes/THEME/functions.php.
I do not want to play around in the file directly and usually create a directory with all my own extensions, e.g. the directory include/ and there I place the code.
In the functions.php I just reference to my code parts:
/**
<li>Custom functions
</li>
*/
require_once('include/functions-custom.php');
How to use the PRE Tag in WordPress?
Looks like WordPress likes to reformat even stuff within the PRE tags.
The easiest was is using a proper plugin. The first one I found which looks really useful is SyntaxHighlighter Evolved. Works smoothly and gives great output. Configuration parameters and usage is explained on the WordPress Plugin Settings for this plugin.
How to install a plugin in WordPress?
The syntax highlighter led me to the next questions how to install a plugin. I do not want to do the automatic upload so the manual process is like this.
- Get the plugin as .zip and unzip it
- Copy the whole content into /wp-content/plugins
- Go to the Plugins > Installed Plugins page in WordPress
- Click activate
Create your own WordPress Theme
The easiest way is using an existing theme and copy the whole directory. A good start to read about creating themes can be found at Theme Development
WordPress Theme Description
The theme information itself is part of style.css and can be found at the top of the file. Let’s create a new one based on Twentythirteen.
Modifying the style.css:
Theme Name: Clean 2014
Theme URI: http://wordpress.org/themes/clean2014
Author: RR
Author URI: http://wordpress.org/
Description: The 2014 theme for WordPress creates a simple theme based on WordPress Twentythirteen
Version: 0.9
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: black, brown, orange, tan, white, yellow, light, one-column, two-columns, right-sidebar, flexible-width, custom-header, custom-menu, editor-style, featured-images, microformats, post-formats, rtl-language-support, sticky-post, translation-ready
Text Domain: clean2014
Links
Updating WordPressOwn directory for WP
Changing File Permissions