The situation in the US is seriously fucked-up right now. I feel so much despair. Is this the beginning of the end of the free world?
The situation in the US is seriously fucked-up right now. I feel so much despair. Is this the beginning of the end of the free world?
Yesterday I wrote about a problem that I’m having with a WordPress plugin that I’m working on, and I said that I think it’s a bug in WordPress. Here are some more information about it.
The plugin should cross-post/syndicate any new post to Twitter. There are a lot of plugins already that does this, but I wanted a few special features.
So far so good. This all works as intended. There is however one more thing that it’s supposed to do:
The plugin hooks into the publish_post action and early on in its code it checks if ( get_post_format( $ID ) == 'link' ). If it returns true an XPath query retrieves the href of the first <a> element and uses this instead of the permalink in the Twitter post.
The XPath part works just fine in all my tests.
As long as I post from the WordPress Admin interface, everything works as intended. The problem occurs when I post using the Press This bookmarklet. When I post this way, if ( get_post_format( $ID ) == 'link' ) never returns true, regardless of the post format.
If I create the post using Press This but instead of publishing I save it as a draft and then publish from the Admin panel, it works as intended.
If so, please let me know.
The code is available on GitHub but I’ve kept the repository private since I’m a little bit embraced by the code, but let me know if you’d like to check it out and I’ll add you to the repo.
I’m working on a WordPress plugin to syndicate my posts to Twitter. I know, there are lots of plugins that does that already but none of the ones I’ve found does it the way I want, so I decided to roll my own. I’ve got the basics working and have been using it on my site for quite some time now. However, I’ve encountered a problem. Here’s how I want it to work:
When I publish a link post, instead of posting a link back to my site to Twitter, it should post the link to the site that I’m linking to. The plugin ”knows” whether it’s a link post or not based on
|
1 2 |
if ( get_post_format( $ID ) == 'link' ) |
At first glance this works fine and it worked in development. However, ones I started using it on my site I realized that it only worked some of the times and other times it wouldn’t recognize a link post.
Tonight I’ve managed to narrow it down. It seems like the problem occurs when I post with the ”Press this” bookmarklet. If I do that, even a post that clearly has been givet the ”link” post format still returns false for if ( get_post_format( $ID ) == 'link' ). If I post the exact same content using the WordPress dashboard the post is recognized as a link post and everything else works as intended.
Is this a bug in WordPress? I should investigate this further but right now I need to go to bed, so I’m throwing the question out to you, smart people on the internet, instead.
Christofer Vilander reposted this on twitter.com.
Henrik mentioned this on blog.henrikcarlsson.se.
Mark Brown’s video series ”Gamemaker’s Toolkit” is very interesting to watch. In the episode I think he manages to explain to me why the games I play almost exclusively are first-party Nintendo games.
You should check it out!

2016 cements its status as a sad year for the arts.

Yesterday when Iris was asleep in her bed, Linn and I sat down on the couch to watch some TV. We’ve just finished the latest season on Modern Family that’s available on Netflix in Sweden1, so we needed to find something new. While browsing for a while, not managing to agree on something, Linns sleepiness got the best of her and she decided to fall asleep on the couch instead.
Even though I was really tired I decided to watch something. Initially I was going to start watching Luke Cage but while browsing a list Zodiac by David Fincher showed up. I tend to really like Fincher’s movies and since I hadn’t watched this one, and since it was still reasonably early in the evening, I went with it. At first I thought I might watch half of it or something and then continue another day but the movie drew me in.
It’s a mystery-thriller based on the actual case of a serial killer who called himself ”The Zodiac”. It features a great cast, including Jake Gyllenhaal, Mark Ruffalo, Robert Downey Jr. and Chloë Sevigny, and I loved it.
I knew very little about it when going into it. I wasn’t even sure if the text at the beginning that proclaimed it to be based on actual events were true or not2 but it totally got me hooked in just a few minutes.
The thing that I really like about David Fincher’s movies is that he thinks, or at least the movies gives the impression that he thinks, that I the viewer is an intelligent and observant person. He loves exposition but not in a bad way.
Also this movie, unlike Fight Club and Gone Girl – which are the two most Fincher movies that I saw most recently3 – is free of irony. It’s an honest thriller that has me invested in solving the crime and that, in a few instances, makes me genuinely scared.
Oh, and in case you don’t obsessive click all the links that I put in this post, you should absolutely check out this one, David Fincher – And the Other Way is Wrong, from Every Frame a Painting. It’s a great analysis of Fincher’s style and as far as I can tell it doesn’t really spoil any of his movies, so you can watch it even if you haven’t watched all his films yet.
Home mastering is hard – but it IS possible.
– Do you make these 6 home mastering mistakes ? – Production Advice
Replies and comments
WordPress Digest
12 november, 2016 16:53WordPress Digest reposted this on twitter.com.
Michael McGinn
12 november, 2016 17:27RT: @synvila-Some more information on the WordPress bug that I think that I’ve found #wordpress blog.henrikcarlsson.se/2016/11/some-m… #waptug 41211
Mikael Jorhult
12 november, 2016 21:53Haft besök hela dagen men ska se om jag inte kan bläddra igenom koden. Vill minnas att jag stött på ett liknande problem tidigare.
Mikael Jorhult
12 november, 2016 22:39Fungerar koden via Press This om det är något annat Post Format? Typ image?
Henrik Carlsson
12 november, 2016 23:07Testade samtliga post formats nu och oavsett vilket jag väljer så returnerar get_post_format() en tom sträng via Press This.
Mikael Jorhult
12 november, 2016 23:14Även om du använder dig av $post->ID istället för $ID? Sneglat i core och Post Formats ska fungera med Press This.
Henrik Carlsson
12 november, 2016 23:25Det fungerar så tillvida att inläggen som publiceras får rätt post format. Det är bara det att det inte verkar vara satt i