WordPress Archives

WordPress is my favorite Content Management System (CMS). Once in a while it helps me make some extra money. Once in a while it helps me look at the problem from a different perspective. But even when it doesn’t, I still enjoy using it for this (and a few other) websites. And I enjoy interacting with the community. I use this category to share bits and pieces which are WordPress related.

  1. The RedHat of Drupal →

    Matt Mullenweg shares a piece of hilarious SPAM he received.  This. Is.  CLASSIC!

    I apologize for the cold email. I was researching Automattic , Inc. and wanted to ask you if there was any gaps/pains within your CMS and website. I work for the “Redhat of Drupal”, (Acquia) and we have seen an explosion of Drupal use in the Media, News, and Entertainment Industry.

    Some companies using Drupal/Acquia include Warner Music, Maxim, NBC Universal, and NPR.
    If you are evaluating your current system or are looking into new web projects, I would love to connect and discuss Drupal as an option.

    Would it make sense to connect on this? If there is someone better at Automattic , Inc. to speak with, perhaps you could point me in the right direction?

  2. 2012 year in blogging

    By Leonid Mamchenkov

    I said it before and I will say it again, Automattic is an amazing company and they do a lot of really cool stuff.  Today I received one more confirmation of that – an email with the link to the report of my blogging through the year.

    Blog stats

     

    I’ve seen plenty reports, graphs, and analysis.  In fact, I have to go through a few pretty much every week.  But I don’t remember seeing anything that awesome!  First of all, the whole page looks beautiful.  It’s an inspiring design with many elements that work nicely with each other.  Secondly, there are no boring graphs or dry numbers.  A few, carefully selected, metrics create a perspective and make it all sound cool.  I don’t know much about other reports yet, but mine said that this blog “had more visits than a small country in Europe”!

    On top of that, the report is a technical masterpiece.  Probably, not many would notice the uniqueness of the fireworks at the top of the page.  But if you just spend a moment, you’ll realize that this fireworks display is unique for every report.  It’s a timeline of blog activity.  That’s why there is a month and day shown for every fireworks shoot out.  (If you are interested in the technical aspects of it, have a look at this GitHub repo).

    As I said, the whole thing is pretty awesome, original, and inspirational.  I wish more companies were doing this.  It would make the world so much better…

     

  3. Instagram Digest : round two

    By Leonid Mamchenkov

    It’s been a couple of month since I mentioned Instagram Digest plugin for WordPress.  Unfortunately, making it work wasn’t as easy as it seemed at first.  The thing is that Instagram’s Developer corner shows you four pieces of information, once you register a new Instagram API application. These four pieces are: client ID, client secret token, website URL, and redirect URL.  Just populating them with sensible values doesn’t necessarily work.

    The trick here is to get a little bit of understanding of how OAuth works.  When a new API application is created, there is an authentication stage, where you, as a logged in Instagram user need to confirm access of the newly created application to your data.  For that, a redirect URL must handle the request from the Instagram, and, in case of Instagram Digest plugin, you need to save the authentication token.

    Too bad the documentation for the plugin is not too clear on that.  Luckily though, after playing around with an deleting and re-creating the application a few times I managed to make it work …

    … just in time for the upgrade of the site to WordPress 3.5.  What’s so special about WordPress 3.5 then? Well, if you look closer at the announcement of this version, you’ll see that the media manager has been changed heavily.  It looks very nice now when you are adding the images the old way, but it also doesn’t work too well with the Instagram Digest plugin.  The gallery is created, but it seems to have all the wrong things in it.  Manually fixing it takes just a few clicks, but is annoying enough, since the whole point of this plugin is automation.

    With that, you do have my first Instagram digest post, and a possibility of a bumpy ride for the next few days until I figure it all out.  If you have any ideas on how to fix it, please let me know.  Otherwise, please be patient.  Maybe spend more time with your family during the Christmas holidays instead of browsing through silly blogs like this one.

  4. Just upgraded to WordPress 3.5.  Everything looks faster and more polished. Let me know if you see any misbehavior.

  5. WordPress Plugin : WP Instagram Digest

    By Leonid Mamchenkov

    For a while now I enjoyed automated Instagram Digest posts in Yana’s blog.  I’ve decided I want the same for my blog too.  A quick Google search suggests that these are done with WP Instagram Digest plugin.  So I’ve downloaded and installed it.

    The configuration is not too complicated.  You’ll need to login into your Instagram account and then go to the developer’s center to register the application and receive the API key and secret token.  Hopefully, eventually this will be a part of automatic configuration, but not yet.  Once you do that, you get can configure the plugin to run at certain times and post to specific category and/or with specific tags.  The cool thing is that you can control the minimum number of new images needed to create a gallery posting.  This feature will prevent empty posts or posts with a single image.

     

    I had to consider if these kinds of posts would be too annoying.  Firstly, I already have an Instagram widget.  That looks nice, but it doesn’t really send out any notifications.  Secondly, when I publish to Instagram I often cross-post the image to Twitter, Facebook, Flickr, and sometimes Foursquare.  I don’t really want to annoy the people with both the individual photos and the digests.  Thirdly, my blog posts are broadcast to Twitter and Facebook, and sometimes Google+.  So, would it be too annoying?  I guess not.  Because since I’ve switched the Social 2.5 plugin, my blog posts aren’t broadcast to Twitter and Facebook automatically – I push them through with a click of a mouse.  So, I guess, I just won’t be pushing the digest posts through and all should be fine.

    The first Instagram digest will be out today at 21:00 (server time).  Let’s see how it shows up.  Hopefully it will also work well with the Lightbox plugin for the image popups.  Curious…

    P.S.: I’ve also introduced a separate category (Photography->Instagram) for these digests and a new tag – “automated” – that I will try to use for any kind of automated postings.

  6. WordPress + P2 = Company Intranet in 5 minutes

    By Leonid Mamchenkov

    I’ve mentioned a few times already that I became a big fan of P2 theme for WordPress.  I currently maintain multiple installations of it, just because it is so easy to setup and start using.  I have it as company Intranet or as a project collaboration tool.  It’s like a blog, a wiki, and a chat room combined together.  And since I’ve installed it so many times, I thought I should publish what exactly I am doing, in case someone else will want to try it.

    Continue reading “WordPress + P2 = Company Intranet in 5 minutes” »

  7. I just realized that elinks console browser actually tries to display site colors to the best of its abilities. I am much impressed!

  8. WordPress Plugins: Liveblog

    By Leonid Mamchenkov

    WordPress.com VIP blog announced the availability of the Liveblog WordPress plugin.  This is pretty cool for anyone doing live coverage of events and such.  One of the coolest things about this plugin is that you don’t have to setup a separate blog for live blogging.  You can turn any post – new or existing – into a live blog and post updates straight from the front page.  People who have the blog post open in their browser, will see a notification of an update available, like the one the screenshot below.

    Pretty cool.

  9. Managing gettext translations on the command line

    By Leonid Mamchenkov

    I am working on a rather multilingual project in the office currently.  And, as always, we tried a few alternatives before ending up with gettext again.  For those of you who don’t know, gettext is the de facto standard for managing language translations in software, especially when it comes to messages and user interface elements.  It’s a nice, powerful system but it’s a bit awkward when things come to web development.

    Anyways, we started using it in a bit of a rush, without doing all the necessary planning, and quite soon ended up in a bit of a mess.  Different people used different editors to update translations.  And each person’s environment was setup in a different way.   All that made its way into the PO files that hold translations.  More so, we didn’t really define the procedure for the updates of translations.  That became a bigger problem when we realized that Arabic has only 50 translated strings, while English has 220, and Chinese 350.  All languages were supposed to have exactly the same amount of strings, even if the actual translations were missing.

    So today I had to rethink and redefine how we do it.  First of all, I had to figure out and try the process outside of the project.  It took me a good couple of hours to brush up my gettext knowledge and find some useful documentation online.  Here is a very helpful article that got me started.

    After reading the article, a few manuals and playing with the actual commands, I decided on the following:

    1. The source of all translations will be a single POT file.  This file will be completely dropped and regenerated every time any strings are updated in the source code.
    2. Each language will have a PO file of its own. However, the strings for the language won’t be extracted from the source code, but from the common POT file.
    3. All editors will use current project folder as the primary path.  In other words, “.” instead of full path to “/var/www/foobar”.  This will make all file references in PO/POT files point to a relative location to the project folder, ignoring the specifics of each contributor’s setup.
    4. Updating language template files (PO) and building of MO files will be a part of the project build/deploy script, to make sure everything stays as up to date as possible.

    Now for the actual code.   Here is the shell script that does the job. (Here is a link to the Gist, just in case I’ll update it in the future.)

    #!/bin/bash
    
    DOMAIN="project_tag"
    POT="$DOMAIN.pot"
    LANGS="en_US ru_RU"
    SOURCES="*.php"
    
    # Create template
    echo "Creating POT"
    rm -f $POT
    xgettext \
     --copyright-holder="2012 My Company Ltd" \
     --package-name="Project Name" \
     --package-version="1.0" \
     --msgid-bugs-address="translations@company.com" \
     --language=PHP \
     --sort-output \
     --keyword=__ \
     --keyword=_e \
     --from-code=UTF-8 \
     --output=$POT \
     --default-domain=$DOMAIN \
     $SOURCES
    
    # Create languages
    for LANG in $LANGS
    do
     if [ ! -e "$LANG.po" ]
     then
     echo "Creating language file for $LANG"
     msginit --no-translator --locale=$LANG.UTF-8 --output-file=$LANG.po --input=$POT
     fi
    
    echo "Updating language file for $LANG from $POT"
     msgmerge --sort-output --update --backup=off $LANG.po $POT
    
    echo "Converting $LANG.po to $LANG.mo"
     msgfmt --check --verbose --output-file=$LANG.mo $LANG.po
    done
    

     

    Now, all you need to do is run the script once to get the default POT file and a PO file for every language.  You can edit PO files with translations for as much as you want.  Then simply run the script again and it will update generated MO files.  No parameters, no manuals, no nothing.  If you need to add another language, just put the appropriate locale in the $LANGS variable and run the script again.  You are good to go.

    Enjoy!

  10. WordPress Plugins : Teleport →

    Teleport is all about getting around WordPress quickly! Use keyboard shortcuts to get where you need to go with just two key strokes.

    First press “w”, then choose from the following:

    • e – (Edit) Edit current post/page
    • d – (Dashboard) Redirects to the Dashboard
    • s – (Settings) Redirects to the Settings page
    • a – (Archive) Redirects to Posts/Pages/Custom Post Types
    • q – (Quit) Logs the current user out / Redirects to Log In page
    • w – Close Teleporter / Log in
    • esc – Closes the Teleporter