Articles in the Wordpress Category
Posted: Apr 23 | Filed under: Wordpress
If you should come in the situation that you always need the same post over and over again, e.g. if you use wordpress as a CMS then I have a useful trick for you.
We have to edit the function “the_editor“, which is defined at general-template.php!
Open the file and find the function; now inside the function find
textarea class='mceEditor' $rows cols='40' name='$id' tabindex='2' id='$id'>%s
Straight after the %s add the text that is supposed to be your default post. If it’s a complex string you can safe the text in a variable e.g. $defaulttext = “here goes my php code”; and simply add $defaulttext after %s, but before the closing textarea tag!
Posted: Apr 23 | Filed under: Wordpress
If you should ever come in the situation that you want a default custom field on your “write page” you should first of all create a draft with your default custom fields.
After that go to your phpMyAdmin interface and lookup the postid.
Once you got the postid simply goto “wp_postmeta” and find the postid of that draft. Change the id to zero.
VoilĂ now you will have the custom field you defined in the draft at your write page. This is especially handy if you always need the same custom field because you can simply copy it.
Posted: Apr 19 | Filed under: Wordpress
To realize a multilingual wordpress you have to follow the following steps:
1. Check if your theme is ready for localization.
To do that open for example comments.php in your theme folder and search for text that is currently displayed on your blog e.g.”Leave a comment”.
If it’s looking similar to
" _e("Leave a comment", "mytheme"); "
then your theme should already be ready for localization.
2. Optional
If not then you will have to wrap the “_e” around every text passage in your theme. Replace mytheme with your theme’s name. Also don’t forget that this has to be inside a php statement!
You can do it like that:
<?php _e("Text", "mytheme"); ?>
Inside a function:
'__('Text', "mytheme")'
e.g.
comments_rss_link(__('Subscribe to the comments via RSS Feed', "mytheme"));
3. Add load_theme_textdomain to your functions.php
This is a very important step because it will load the text via gettext before sending out the headers. Add the following at the very first line of your functions.php inside your theme folder: (if you don’t have one create a functions.php!)
<?php load_theme_textdomain('mytheme'); ?>
Posted: Apr 07 | Filed under: Wordpress
If you are looking for a solution to exclude subcategories, here is a very simply way:
$categories= get_categories(); foreach ($categories as $cat) { if($cat->category_parent == 0){ DO WHATEVER YOU WANT TO DO } }
You could use this code to make a dropdown box without subcategories.
Here is the wordpress reference for “get_categories” with an example of a categories dropdown box.
Dropdown box
Posted: Mar 30 | Filed under: Wordpress
One of the most important thing for a wordpress developer is to know where the user is right now. The wordpress reference has a very important site that shows all the necessary functions to do that.
That links is definetly a must-have-bookmark for every WP developer!
Posted: Mar 27 | Filed under: Wordpress
A lot of people are sick of the wordpress editor because it will mess up their posts.
Here is the solution that worked for me. I do not say that this will work for anyone. A lot of people don’t want to turn of the Visual Editor to quickly edit their posts, but you will have to.
Turn it off Go to “Users” -> “Your Profile” and uncheck “Use the visual editor when writing”.


