Polylang Snippet: Automatically get id of translated page

I’m currently working on a multi-language WordPress site project and while I’m trying to build everything without having to rely on specific page id’s, it happens from time to time.

I’m using Polylang to achieve the multi-lang capability and this plugin is great. Thanks for the recommendation goes out to Nils.

Let’s say our default language is german and you need the title of a specific page and this page has the id of 52. This is how you would normally do it:

<?php echo get_the_title(52); ?>

But this will always return the german title of this page no matter the current language. That’s because with Polylang a translation is just a new page which is internally linked to the other. This means the translation of page id 52 might actually be page id 106.

So while I need the title of page id 52 in the default language I want to output the title of page id 106 when english is active.

Luckily there’s an easy way to do that with Polylang:

<?php echo get_the_title(pll_get_post(52)); ?>

This will recognise the link between page id 52 and 106, check the current language and use the right id. Happy end!

Weekly Recap #CW30 2014

This week was full of CSS goodness, a week entirely to my taste. I hope you like it, too. So let’s not waste too much time and get right into it. Enjoy!

RWD Bloat

Dave Rupert:

So I’ll put my own site under the microscope. I’m a seasoned RWD developer, I’ve worked on large projects, I co-host an award-winning front-end sound effects podcast, and I care about web performance; so my own blog should be a perfect use case.

Dave Rupert puts his own site under the microscope to find out how much page weight is generated by making his site function in a multi device world. At the end he goes on to see what he can do to further improve performance. Interesting read and probably something everybody should do sooner or later. At the least it’s a great learning experience.

Bye minimal-ui viewport property

iOS 8 Beta 4 Release Notes:

The minimal-ui viewport property is no longer supported in iOS 8.

You can start to say your goodbyes to the controversial minimal-ui viewport property as it will be no longer supported in the upcoming iOS 8. After being a fan at first, I think it’s good that Apple is cancelling this feature.

Say hello to marcel.io

A few weeks back my good friend Marcel decided that he needs a new portfolio site to show off some of his best work to kickstart his freelance business. If you already follow me along for quite a while you know that we worked together a lot so it was a natural fit that I would develop the site.


Marcel made a clean one-pager layout that focuses on the different app designs. Since the site is very simple and won’t change that often we decided to omit a CMS and build a static site. It’s probably also faster.

For me it was a nice project to try a few things and most of all get to know Vim without the pressure of a big client projects deadline. The site is fully responsive, retina ready and makes use of SVGs where possible. I also tried to build modular Scss and added some custom jQuery Javascript. The sliders are based on the amazing bxSlider.


We tried to keep the size of the page small, but due to the sheer amount of screens it’s not the slimmest site ever although we made use of srcset and picturefill.

Visit marcel.io 

That’s basically it. If you want to know more you can have a look at the code on GitHub, send me a tweet @_martinwolf or write an email to martin@martinwolf.org

Weekly Recap #CW29 2014

This weeks recap is largely affected by working freelance and web performance topics with some other article recommendations sprinkled in. Enjoy!

Pushing to multiple git repositories simultaneously

I currently host private git repositories on my own server. This is relatively cheap and it gives me a feeling of security in case a service decides to shut down, gets hacked or whatever. It’s also in line with the Develop It Yourself methodology Bastian Allgeier wrote about recently.

But we all know that GitHub is THE place for open source code and the programmer community. Sometimes it can even act as a kind of resume. So there is certain code I want to have on GitHub, but also on my own server.

Luckily that’s very easy to achieve with no overhead because you can push to multiple repos with one command. The only thing you have to do is add both remotes to your git config. You have two options how to do this.

You can either go into your .git folder, open the config file and manually add the needed information like that:

[remote "all"]

Or you can add the information from the command line:

git config --add remote.all.url ssh://url/to/repo.git
git config --add remote.all.url ssh://another/url/to/repo.git

And now you can push to both repositories at the same time with

git push all

And here an example of a project I simultaneously host on my server and on GitHub. The WordPress Theme of wolfsport.de, the soccer blog of my brother I wrote about recently.


Weekly Recap #CW28 2014

Hey folks, I hope you had a lovely week and got some time to finish it off with reading a couple of fine articles. Enjoy!

Developing wolfsport.de

Somewhen last week Henning, my brother, decided he wanted to start blogging. The topic should be sports in general, but mainly soccer. We decided to use WordPress and naturally I wanted to build a custom theme for him.

So on the weekend we had a Skype session with screen sharing and build him a relatively simple theme. The name was clear pretty early on: wolfsport.de


The focus should be the text, so we went for a single small column and the nice typeface Fira Sans.
He had a pretty specific idea for a logo, which we put together with my little bit rusty Photoshop skills. It would be nice to have the logo as an SVG, but I only had raster graphics to work with. Maybe I can rework the logo in Illustrator in the future.

I didn’t use any frameworks or the like for the frontend, only some styles from my own, incomplete boilerplate like my slim _normalize.scss. The site is complete responsive, but because of the simplicity of the theme, there wasn’t much to do to accomplish that.

On the WordPress side of things we use Cachify to cache and deliver static, minified HTML which speeds up the site tremendously. I also installed Statify so Henning can get a sense of how popular his blog gets. That’s about it.

It took us about four hours from idea to finished WordPress site. If you want to have a look at the code, it’s on GitHub: https://github.com/martinwolf/wolfsport

Weekly Recap #CW27 2014

Hello and welcome to this Weekly Recap. Today I’m on time again and that’s good news, isn’t it? So don’t let’s waste time and get right into it. Enjoy!

DIY — Develop It Yourself

Bastian Allgeier:

At least for me it has led to a revival of my DIY past. Instead of spending time on something that might be sold or shut down tomorrow I much rather put on some safety goggles and build my own thing.

Bastian goes back to building stuff on his own. This post really resonates with me because I recently started to host and build more stuff for myself, too. For the first time I have a shared server, host my own git repositories, have my own image sharing service, and more. On the one hand it’s because I want to be independent and on the other hand it’s just fun.

Weekly Recap #CW26 2014

For the first time I forgot to post the Weekly Recap on sunday morning. I was on the road for a few days and got totally mixed up with the days. I’m sorry! So here we go. Weekly Recap of calendar week 26 of 2014. Happy reading.