Author: latz

  • WordPress: Überprüfen, ob ein Beitrag das more-Tag enthält

    Manchmal möchte man einen Beitrag abhängig davon gestalten, ob er ein <!–more–>-Tag enthält oder nicht. Leider verfügt WordPress nicht über eine Funktion, um diese Prüfung vorzunehmen. Befindet sich der Beitrag innerhalb des Loops, so kann man aber folgende Funktion benutzen:

    function hasMoreLink() {
    	global $post;
    	return strpos($post->post_content, '');
    }
    

    (Bitte “nore” mit “more” ersetzen, konnte ich aber nicht eingeben, weil sonst WordPress das Tag auswertet.)
    Danke an MichaelH aus dem englischen WordPress Forum

  • WordPress Plugins übersetzen

    Viele WordPress-Nutzer bevorzugen eine deutsche Oberfläche, weil sie der englischen Sprache nicht mächtig sind oder es einfach als angenehmer empfinden, sich mit ihrem Blogsystem in ihrer eigenen Muttersprache zu verständigen.
    Für das Basissystem von WordPress wird mit großem Enthusiasmus vom wordpress-deutschland.org-Team eine Übersetzung bereitgestellt. Viele Plugins allerdings nicht nur in englischer Sprache verfügbar, was nicht nur den Nutzer verwirrt, wenn plötzlich Meldungen in einer anderen Sprache erscheinen, sondern auch ein uneinheitlichen und unprofessionelles Bild ergibt.

    Zum Glück ist es in WordPress aber relativ einfach, Plugins in eine andere Sprache zu übersetzen. Sofern das Plugin es vorsieht und die Funktion __() (Doppelunterstrich) oder _e() für die Textausgaben benutzt. Diese Funktionen benutzen die gettext Bibliotheken und Werkzeuge.
    (more…)

  • Electric-Trick

    electric-trick
    My first try at macro photography.

  • Tabelle zeilenweise ausblenden mit jQuery

    Möchte man mit jQuery einige Zeilen aus einer Tabelle ausblenden, so könnte man auf folgende einfache Lösung verfallen:

    Ursprüngliche Tabelle:

    Zeile 1
    Zeile 2
    Zeile 3

    Tabelle mit <div> und checkbox:

    Zeile 1
    Zeile 2
    Zeile 3
    Zeile 2 verstecken

    jQuery-Code zum Ausblenden der Zeile 2:

    function hideshow() {
      if ($("#cb_test").attr("checked"))
        $("#test").hide();
      else 
        $("#test").show();
    }
    

    Dieser Ansatz funktioniert leider nicht, da es nicht möglich ist, Tabellen- und Textstrukturierungelemente zu mischen. Seit HTML 4 gibt es allerdings das <tbody>-Element, das man für diesen Zweck verwenden kann:

    Zeile 1
    Zeile 2
    Zeile 3
    Zeile 2 verstecken

    Laut HTML-Validator des W3C ist diese Lösung “HTML 4.01 Transitional”-valide.

  • Invite Data to your birthday party… almost!

    Nice Tweet from Brent Spiner, the actor who impersonated Data in the Startrek Next Generation series:

    I am available for birthday parties and weddings (straight or gay). I won’t come as any character and I won’t do anything but eat cake.

    (Link)

  • 7 reasons that make me NOT listen to your web radio

    I like to listen to web radios of all kind and like to discover new ones. But if you want to keep me from listening to your station on a long term try to avoid the following:

    1. Bad stream quality
      FM was invented in 1925 by Abraham Esau and we can listen to good sound quality radio for over 75 years. Why should I listen to your 64 kbps or even 24 kbps radio? If you can’t afford the bandwidth then try at least to spice up the stream with AAC.
    2. Ever changing IP address
      If I like your radio i will put it in my bookmarks. It’s quite anoying if I try to listen to your stream the next day and the player can not find it. More often than not I’m too lazy to look for the new address and simply delete the bookmark. Get a domain name, it’s cheap.
    3. No ID3 tags
      I like to know to what song I am listening right now and my media player will tell it to me if… if you put the ID3 tags into your stream.
    4. Repeating always the same songs
      Classic Rock, New Wave or 80’s collections should contain more than your 20 favourite songs. Such small collections will keep me one hour with your stream and off you go.
    5. Force me to install any plugins
      If you want me to install any plugins because you’re using some esoteric codec you’ve lost a new potential listener this very minute.
    6. Not following any conventions
      There are some unwritten conventions which will make the life of your listeners easier. You should for example put the station’s name and any other additional information in round brackets behind the ID3 informationen. This will enable the lyrics plugin my to distinguish between them and to display the correct lyrics.
    7. No MP3/OGG stream
      Some people want me to use their almost unusable Flash players to listen to their stream. Despite the poor sound quality most of these players offer I don’t want to have an open browser tab or an extra browser window on my screen. I like my media player and it’s the only application use for music (OK, the last.fm player is an exception).

    Most web radios are aware of the bad habits above and try to avoid them and if not, many will change their streaming after a small hint.

  • Tweetback v0.2

    Tweetback has been updated to version 0.2 and includes the feature I definitely missed. Now you can define users whose tweets will be ignored. This is important if you are using Alex King’s Twitter Tools and publish your new blog entries on Twitter. Until now it always resulted in a Tweetback from myself to myself. This is history with the new version. Thank you Florian.

  • Remove Google Reader’s Toggle Bar with Firefox

    How often do you collapse your subscription list in your Google Reader? I assume you tried it once and after that you never did it again. So why not remove it? It’s simpler you think:

    1. Go to your Firefox profile/chrome/ directory.
    2. If there’s a file called usercontent.css open it, otherwise create a new file with that name.
    3. Enter the following:
      #chrome-lhn-toggle {
      display:none;
      }
    4. Restart Firefox.
    5. Enjoy!

  • Greasemonkey-Skripte extrem einfach finden.

    Nicht immer zeigen Webseiten ihre Informationen so in Form und Inhalt wie man es gerne hätte. Zum Glück gibt es für Firefox das Add-On Greasemonkey, mit dem sich geladene Webseiten nach Belieben ändern lassen oder mit neuen Funktionen erweitern lassen.
    Natürlich wäre es nicht sinnvoll und möglich alle gewünschten Skripte selber zu schreiben, deshalb gibt es unter userscripts.org eine mehr als reichhaltige Sammlung (mehr als 24000).
    Um den Zugriff auf mögliche Skripte zu vereinfachen gibt es jetzt ein Firefox Ad-On namens Greasefire, mit dem sich mit einem einfachen Klick auf die rechte Maustaste überprüfen lässt, welche Skripte für die augenblicklich angezeigt Webseite bei userscripts.org bereit liegen:

    Screenshot
    Screenshot

    Wählt man den obersten Menüpunkt aus, so öffnet sich ein Fenster in dem alle verfügbaren Skripte aufgelistet sind:


    [larger image]

    Die Skripte lassen sich nach Name, Bewertung, letztes Update und Downloads sortieren. Ein Klick auf ‘Install “Skriptname”‘ installiert das Skript und nach dem Neuladen der Seite beginnt das Skript mit der Arbeit. Schöne Sache…

    Links:

  • AOL reveals: Michael Jackson is dead

    … or how should I understand this? (I know, I know, it’s the Dead people he’s singing about 😉 )