The Loop

Where humor doesn’t work.
Dec 5, 2017 19:16
This is worth the trouble only for complex plugins, or if you work on a whole website where you can share the facade layer across all plugins you'll write for the website.
Dec 5, 2017 19:16
If you want to work with WP using OOP than you need to write your tiny facade layer that interacts with WP and offers an OOP interface to your code.
Dec 5, 2017 19:16
Final class + interfaces is a godsend for proper OOP that is based on composition and not inheritance. The problem is that WP is not OOP and classes are used as poor-men namespaces.
Aug 7, 2017 19:38
If you really want something OOP and WP-specific then Alain Schlesser (alainschlesser.com) or Carl Alexander (carlalexander.ca) blog a lot on the topic and their stuff is quite good.
Aug 7, 2017 19:38
@rob-gordon searching "OOP & WordPress" you can find tutorials, but many of them don't use interfaces nor an approach very similar to mine... But outside of WordPress bubble this is pretty simple & standard (& boring) OOP PHP. So if you manage to understand OOP conceptsin PHP than you just need to apply them in WP... WP is PHP, after all (for now, at least).
Aug 1, 2017 11:28
Yep @Rarst BrainMonkey adds to Mockery WP and functions stuff. For other magic you can rely on Mockery directly. And thanks @kraftner :)
Jun 13, 2017 13:46
I don't thinks is a matter of "skill", but more of a matter of priorities. Making people see a WYSIWYG on their existing widgets without doing anything is a "wow" moment from marketing POV, who care about consequences. So imo it's more marketing > dev issues, which is a constant of WP.
Jun 13, 2017 13:37
Everyone was saying that to create a new widget had been better... but Matt said no. Can you think anyone better to make developer's decision than a guy who don't touch code since 10 years?
Jun 13, 2017 13:34
Hi @JackJohansson I can tell you I blocked all sites I control to 4.7 waiting the fix that. As usual, BC in WP is strong, eagerly to follow the shine is stronger.
Jun 13, 2017 13:31
Thanks @Rarst
Jun 13, 2017 13:30
@Rarst before I did Yoast code... IIRC you worked on the sitemap feature. Is there any way to completely block the feature?
May 23, 2017 18:11
$('.class').not('.class .class') should work?
May 23, 2017 18:10
See here: github.com/WordPress/WordPress/blob/master/wp-includes/… query_vars filter is applied at some point from the line 733, pre_get_posts for main query is triggered at some point from line 735
May 23, 2017 18:07
@MarkKaplun pre_get_posts is called lot of times. If you target main query, pre_get_posts is called after query_vars filter. In fact, it is called by WP::parse_request() which happens before WP::query_posts()that triggers the main WP_Query so triggering pre_get_posts for it.
May 7, 2017 08:38
@Howdy_McGee saw your answer already accepted (and upvoted it). I just added a comment there.
Feb 5, 2017 20:21
thanks @prosti :)
Feb 5, 2017 14:39
Thanks :)
Feb 5, 2017 14:38
@Rarst Probably not. My wife is pregnant, and the baby is coming in May, so April is dangerously close. I sent a speaker application, but I'm quite sure is not going to be accepted, sent it just to have some ticket reserved a bit longer :)
Jan 25, 2017 15:17
@Rarst thanks for the info.
Jan 25, 2017 12:16
It's long time I don't care about PHP version support in WP so I might have missed something: these days there's some information about PHP ver used by WP users according to the WP version? I see official stats says 5.9% for PHP 5.2, but how much of them are from people with very old WP version?
Jan 18, 2017 15:29
For me bad experience with WPE. Restriction on plugins, custom MU plugins and wp-config stuff that you are forced to use. Also no shell access and pretty broken Git integration makes SFTP only viable "deploy strategy"... And recently a client want to leave them because they are going to change price policy (not sure how) and is going to become very expensive if you have a lot of users. There are some nice things like automatic staging environent, but I would not recommend them.
Jan 9, 2017 17:19
At average, a month full time PHP in Italy is in the range 2500€ - 3500€ before taxes, which becomes around 1700€-2200€ after taxes. As freelance the raw pay is more because you pay much more taxes. Half (and even more) of the money you get as freelance goes in taxes... That's main reason I gave up with freelancing...
Jan 9, 2017 17:03
A medium company may pay you 300€ day if they like your work. If you count billable hours, a day is no more than 6 hours, which makes 300€ a 50€/h. But if you try to negotiate 50€/h you are not going to take that job...
Jan 9, 2017 17:03
Freelance market does not really exists in Italy. A freelancer is a one-man-company, at any effect, including laws and taxes. Big companies hire only agencies, so as freelancer you can only get work from small/medium companies. For my experience with those clients, in Italy, is better to negotiate using day pay.
Jan 9, 2017 16:40
Well, 28€/h are 224€ per day, considering a 8h day. That's considered a quite good pay in Italy. Some company may pay you 300€/day but very rarely more than that.
Dec 16, 2016 18:37
@prosti there's no topic in this room (or all topics if you prefer), going off topic is literally impossible. Just, as tagline says, don't expect humor ;)
Dec 10, 2016 18:19
@Rarst yep, didn't uset it anymore. Regarding {$type}_template_hierarchyan issue is that you let WordPress traverse its hierarchy, calling file_exists a number of times, and then you replace what WP find anyway. Honestly, the now rare times I do theme stuff, I use Hierarchy (github.com/Brain-WP/Hierarchy)
Nov 20, 2016 14:52
If that would land in WP core, among other things, connect multiple attachments to a post would be much easier. Thew post_parent that core uses to connect images and posts is just broken because you can attach images to many posts but only one can "own" the image as parent, and in a non predictable way: sometimes you attach an image to a post and the post becomes image post_parent, sometimes just not.
Nov 20, 2016 14:52
I think that one of the things that is really missing in WP as CMS is a way to connect post types using a many-to-many relation. That one needs to implement a such common thing from scratch (UI, API, storage model...) is crazy. All other major CMSes allow that.
Nov 15, 2016 15:04
@Rarst is the code public, can you somehow show me?
Nov 15, 2016 06:38
@Rarst good :) Sorry for late answer, just saw the message. BM exposes Mockery, so it uses what Mockery provides: gist.github.com/Giuseppe-Mazzapica/… and generally speacking, everything you find in Mockery docs (docs.mockery.io/en/latest/reference/index.html) can be used in Brain Monkey as well
Nov 13, 2016 17:45
Something like Carbon for WP specific stuff would be really nice indeed
Nov 13, 2016 17:44
@Rarst I used DateTime fo WP stuff many times, never tried to build something reusable on top of it (strange, eh? :D)
Oct 27, 2016 07:05
@Jean-philippeEmond get_user_by( 'login', $username ) can replace username_exists
Oct 13, 2016 07:14
@Howdy_McGee get_query_var() works only for main query, $query->get() is for any query. So if the object bassed by posts_where is not the main query, get_query_var() can't work.
Oct 11, 2016 16:21
The sad thing is that patch was reverted for readability. I mean, really, no better excuses?
Oct 10, 2016 15:08
@DᴀʀᴛʜVᴀᴅᴇʀ with menu_page_url you get the URL of the plugin settings page, and with wp_redirect you redirect the user there. Just check user is logged in and has proper capability before to redirect...
Sep 30, 2016 15:35
@kraftner honestly, if somebody would be pissed off, I really don't care. As long as I did not break rules or copyrights, I am very fine and I live in peace. So, for me, I would just leave that as is. But wecodemore is not my vendor, I received the permission to push there just before to push wp-downloader. What I do care is to avoid any, even minor, issue to @kaiser just because he trusted me on give me access on that vendor. So I will remove it, at least for now.
Sep 30, 2016 15:08
When and if WordPress will decide to push to packagist, they will be perfectly allowed on doing that, and from that moment now one will be able to push to wordpress/ namespace. But still everyone will be able to "provide" things in wordpress/ namespace, because "providing" has nothing to do with "owning".
Sep 30, 2016 15:08
By "providing" a package, you don't "create" it, nor you claim its ownership. If that would be true, when someone would try to push a package using that namespace, it would be blocked, because Packagist doesn't allow to push packages in a namespace owned by someone else. But right now, everyone can still push a package in wordpress/ namespace because no one claimed the ownership of that namespace.
Sep 30, 2016 15:02
Other packages could require wordpress/wordpress-implementation being satisfied when any of the packages above is installed.
Sep 30, 2016 15:01
In a better world there would be a wordpress/wordpress-implementation virtual package, and then wp-downloader, johnpbloch/wordpress, wordpress/wordpress, and maybe others, all would provide wordpress/wordpress-implementation.
Sep 30, 2016 14:51
Also using provide with vendor you don't own is how it is intended to be used, actually. If you look at packages that provide, for example, psr/log-implementation none of them own "psr" vendor.
Sep 30, 2016 14:51
@Rarst because it provides wordpress/wordpress... literally. If you install wp-downloader, on composer install you get wordpress/wordpress, even if wp-downloader does not require wordpress/wordpress. Because wordpress/wordpress is provided by wp-downloader.
Sep 29, 2016 21:20
You can check query var...
Sep 29, 2016 21:19
@Howdy_McGee get_queried_object() should not be used inside pre_get_posts, it's too early
Sep 29, 2016 20:26
@Rarst what I did? :0
Sep 25, 2016 19:08
@hakre if you use Composer there are different ways to use it to install WP from command line. One is github.com/wecodemore/wpstarter that would not remove xmlrpc.php but you can just add Composer script like rm /path/to/xmlrpc.php
Sep 5, 2016 07:34
Hi folks, I am back :)
Aug 23, 2016 09:10
Hi everyone! Just to inform that I'll be offline for 15 days for my honey moon :) Just to don't let you believe I ran away just after mod election :D