Archive for the ‘PHP’ Category
Lesson of the day: Open source software rocks
As those of you following me on Twitter (I'm larskjensen) may know, we recently launched our WordPress powered blog community.
For those of you who don't know what WordPress is (although you should! :-)) it's the state of the art blogging software - and it's open source and free of cost. For our blog community we use the multi user version of WordPress, the aptly named WordPress MU.
Well, we've had some problems with some of the themes of an older date. The CSS in them acts quite weird - most often in Internet Explorer 7…
Anyhow, I have an email correspondance with one of our bloggers and I tell him that either I'll try to find an update for the theme or otherwise we'll have to phase out the theme. But before I can do anything he has written me another mail telling me that there is an updated version of the theme and he also gives me the link.
So I translate the theme (by adding the _e and __ WordPress translation functions to .php files of the theme) and update my already existing language file with the new theme, upload it and email our most friendly user to tell him that the new theme is now online for him to test.
All this just to point out one thing: Open. Source. Software. Rules. :-)
PS: This blog is running on the single blog version of WordPress - of course.
Related postsTags: Blogging, Blogs, Danish media, Open source, PHP, Social web, wordpress
WordPress 2.2 meetup is under way
Related postsWorking with search recognition in WordPress
I'm currently working on my master project at the Danish School of Journalism where I'm doing a communications assignment for a café and nightclub in Copenhagen named Nadsat.
A part of my project is to create a new website for Nadsat which I have chosen to be, of course, powered by WordPress.
As I've included a search that also searches in pages in WordPress (by using Dan Cameron's Search Everything plugin) since WordPress doesn't do this by default, I got an idea:
Why not have some sort of recognition to save people to some time when they're searching for information on the site? Let's say that someone searches Nadsat.dk for "effekten", which is a collective throwing parties at Nadsat, why not save them time by telling them where they can read more about Effekten (Danish for "the effect")?
So here's what you do. You take the code provided below and use it somewhere in you Search Results page (found in WordPress admin ==> Presentation ==> Theme Editor) and you're set :-)
Okay, so here we go. Remember that "$s" is the search query and we'll be using this in this classic elseif PHP code. Also note that if you want to write a quotation mark in PHP you write \". Let's get to the code:
<? if ($s == "x") {
echo "You searched for x. Blah blah blah <a href=\"http://www.test.com/test\">click this link</a>";
} elseif ($s == "y") {
echo "You searched for y. Blah blah blah and so on";
} elseif ($s == "z") {
echo "You searched for z and probably get it by now";
} else {
echo "Your search query \"" . $s . "\" wasn't recognized";
} ?>
This is just basic PHP, no WordPress-only in there :)
*** UPDATE UPDATE UPDATE ***
I just realized that the code above is case sensitive. With the code below a search for "Effekten" will be converted to "effekten" as would "effeKten", "eFfEkTeN" and… you get the picture :-)
<? if (strtolower($s) == "x") {
echo "You searched for x. Blah blah blah <a href=\"http://www.test.com/test\">click this link</a>";
} elseif (strtolower($s) == "y") {
echo "You searched for y. Blah blah blah and so on";
} elseif (strtolower($s) == "z") {
echo "You searched for z and probably get it by now";
} else {
echo "Your search query \"" . $s . "\" wasn't recognized";
} ?>
Tags: CMS, PHP, Search, Searches, wordpress
WordPress DK meetup this sunday
For the Danes out there: This Sunday we're doing it again — yet another WordPres Meetup.
Related postsGuide to writing your own WordPress plugins
Have a yet non-existing feature that you need pretty bad in WordPress?
Then create your own plugin.
Here's a guide on how to write your own plugins for WordPress.
I haven't had the time to check it out yet, but it sounds like a sure read :-)
Related postsTags: CMS, Extensions, PHP, wordpress
WordPress 2.2 released and installed
Most WordPress users may have seen this, but WordPress 2.2 has been released.
I've updated my blog, and everything went smooth. I:
- Uploaded the new files and replaced the old WordPress files with the new ones
- Went to %blog address%/wp-admin/upgrade.php.
- Wondered that there was so little to do :-)
Oh, and our local hero René has one again done a fantastic job and translated WordPress 2.2 into Danish. Very nice!
Related postsShowing multiple pages of entries in 3K2
As you may or may not know, I recently switched to the 3K2 theme on this blog.
I'm very happy with it, but something kept irritating me. In the search results, you can't browse back to see entries prior to the 10 results listed on page one. The same things happens, when you're viewing a certain category/tag. Basically: The "previous entries" and "next entries" are missing at the bottom.
I found out, that this relates to the "rolling archives" feature, that deploys a vertical scrolling bar where you can flip through the pages. This bar doesn't show up in search results or in category pages. But I like the rolling archives feature, so I want both. But how?
Simple:
In your WordPress admin section go to Presentation –> Theme Editor –> theloop.php
Find the following (it's near the bottom of the file):
<?php /* Insert Paged Navigation */ if (!is_single() && get_option('k2rollingarchives') != 1) { include (TEMPLATEPATH.'/navigation.php'); } ?>
This tells WordPress to show "navigation.php" (which holds the "previous entires" and "next entires" links) to be displayed IF you're NOT looking at a single page/post AND the "k2rollingarchives" isn't set — that's what "!= 1" means. "!=" 1 basically means "different from one" - aka "not set" in PHP language.
So, just delete the following and you're set to go:
&& get_option('k2rollingarchives') != 1
Now you have the rolling archives at you front page AND the links at the bottom to previous and next entries. With this on you also ensure that Opera Mini users can view your site :-)
Related postsTags: About this blog, CMS, PHP, wordpress
Danish translation of WordPress 2.1.3 ready
For you Danish WordPress users out there:
The Danish translation of the latest version of WordPress (2.1.3) is out now.
Download WordPress 2.1.3 in Danish.
Read the blog entry regarding the release (in Danish).
Note: This also includes a Danish translation of the 2.0.10 release, since WordPress has chosen to continue support for the 2.0.x branch.
Related postsTags: CMS, Open source, PHP, wordpress
WordPress 2.1.3 is out
Open source content management system WordPress 2.1.3 is out, downloaded and installed - worked like a charm :)
Related postsWordPress 2.2 in less than a month
On the WordPress "wp-testers" e-mail list word is, that open source content management system WordPress 2.2 is set to be released on April 23rd.
Still, the list of new features is a pretty early draft, so we'll have to wait and see ;)
Related posts