its feels more like routing in Laravel, so long as this doesn't interfere with the internal WP rewrite mess then this is a pretty interesting solution, good effort.
Well, 24 times the screen height is a bit too much in explanation. But anyway, the approach looks sane and sweet. Something that I'd think about using. Congratulations. Now I just have to look at the code :)
At some places you're using protected. Is it meant to be overwritable? If so, then you should somehow document it.
If not, then drop it.
But in any other case, I'd just go and make nearly everything public that doesn't conflict with your idea when someone wants to overwrite it in an extending class.
Another thing would be using getters/setters. You got lots of defaults, moving parts that you set or change on the fly. I'd centralize it. Much easier to keep overview if you know what's happening everywhere when you use a var.
The clever_request_vars could be a standalone object. Something that implements an Iterator for example or anything similar. Maybe Countable as well. You can then have ArrayAccess to it and so on.
In the linked library - it's meant as example/no real world use - look at the Interface in the same folder. I tend to as well keep phpDocBlocks only there. Makes the other stuff more readable, but delivers an easy overview, error messages and in case even the docs.
I've not used interface because keeping everithing in one file, with interface code became more verbose, i.e. 1082 lines will became at least 1500, I don't know if it improve readability...
1. If something got if/else it's a hint to split things up into several methods. If it got elseif, you might be doing something that does too much. If you got more then one if, ... you know how it works. 2. Things easily lead to callback hell. When you got several filters or hooks in a single function, then it can already be close to impossible to debug.
@G.M. I guess you can drop the mu-plugin idea already. From my experience most people anyway don't know that mu plugins exist :P
Back to (2): If you use getters/setter, a lot of filters can be moved there. Much easier to test single methods then. Even with custom cases.
I have also a MU plugin that is just the copy and paste of WP_Post class, because it is final for someone know reason...
However thank for your great help. @kaiser
I thing next sunday I'll drop from MU plugin idea and start separate code in files, use getter and setters, and probably namespaces (I've not used the for single file problem).
Just an example. Using interfaces helps sketching code. You can write doc blocks and what task a method solves, which responsibility it takes. Rule: Never more than one.
I found your diagram pretty nice (the Yes/No thing). Maybe you should start just there and transform such a thing into an interface. Then fill in the bits.
The $pieces var contains the parts that have previously been the $url. So you can name them $urlPieces so everybody quickly understands where they're coming from.
I'd even rename that to $urlParts as its more common.
@kaiser I finally found out how to execute bash..for that program I mentioned a couple days ago, the script need to be in the default /bin folder which happens to be in C:\Users\-- your - user --\AppData\Local\Temp\MobaXterm6.6\bin
or you can run echo "/bin PATH = $(cygpath -w /bin)" to find it
@ChipBennett yeah ... it just came to my mind from looking at the profile of that user ... But nevermind. Before someone get's me wrong. There are also quite a lot people from those countries who are helping a lot ....
I'd really like to know whats the average income there. Seems like most of the Pakistani/Indian/Bangalore guys really put a lot of time pressure on themselves by going even too cheap for their standards.
@kaiser I'll never be one to disparage someone based on their country or the economic conditions there. I have more respect for someone in India doing WordPress development for $2/hr than someone here in the US sitting on their duff and getting paid $30K/year in government assistance.
@ChipBennett 30k seems pretty low for U.S. standards. Especially as you (a) get paid per week(?) and (b) don't get 14 month salary per year and (c) ain't have the insurance we got.
@kaiser No, simple answer for this. You got to find the right people and that's pretty hard ... but in the moment it's working pretty well. Had to go through some bad experiences before I had a workflow that was working ...
@ChipBennett Uh. That's a lot. Always thought US didn't have a "welfare state" like her in europe.
@kaiser People from there (also in the chinese region) have a attitude that they'll never say "no" to you... if you ask them "Can you rebuild TinyMCE from scratch in 1 week for 200$?" 99% of the people will tell you "no, problem".
@s1lv3r sad but true. And if you work - at all - you get cut off. So, anyone who wants to get out of the government-dependency rut has to jump the gap between an entry level job and the full value of government assistance. The gap between the two is getting wider, which just locks people into government dependency.
Hey, I got a small tricky question. If example.com/type/link/ is the URL of Link post format archive, what'd be the URL of a custom post type's post format archive? example.com/cpt-slug/type/link/ gives me a 404 error.
@its_me by default, a CPT doesn't have a format (post_format taxonomy), because post_format taxonomy support is not registered for a given CPT object. :)
What you're experiencing (AJAX works locally, but not on the server) is a delay problem. Locally everything works that fast, that you can't see your problem.
Register Scripts and move data from PHP to JS
Register and enqueue and localize your data the right way: Wrap it in a function or method ...
I accept upvotes /Cc @GhoastToast might want to read that.
Looking at Ghost core. Config is in route dir. Then there's content dir for themes and plugins. Wonder a bit about that approach. Would have thought that they might have a more sane route: Ghost in subdir/assets/vendor/node_modules or something like that and plugins/themes/etc. extensions outside of Ghost. Looks as stupid as WP does it. Oh. And a theme seems to be a .gitsubmodule.
yep themes are submodules. Why the heck is someone doing that when it's build upon node and npm ships with it?
From looking through repos linked in their marketplace this seems to be the case for all. So one has then to pull in alternate themes as submodule... or whatever the workflow is. Aside from bower I know no single library where you can define the target directory. And even bower isn't able to push to different directories. So I guess there's no way to use plugins and themes in different folders aside from git.
@TomJNowell I recently came to the impression wordpress is fairly slow when compared to other CMS ... had some projects which used some custom CMS and also a Contao project ... page loading times where so much faster than with stock wp.
@s1lv3r WP loads almost everything, wether you're on a fresh install or a 2 year site, which is why stuff like Nacins 'autoloaders dont make things faster' comment is such a '0_o' comment and glosses over the core problem
the issue with WP is not as much stock speed as inability to manage load process to fine tune it. you start at certain baseline performance and it's extremely challenging to speed up
Yeah, I guess it's pretty easy to build something that loads fast if you are custom building it for one usage. The custom CMS has load times of ~20-30 ms on a VPS for every page. I can only dream of getting that with wordpres. I'm not getting near to that using page caching in memcache ...
whole page caches are a mess, I am dissapointed in them. I had whole periods where cache pretended to be functioning normally while doing absolutely no caching
varnish is great thing, but the issue is WP doesn't quite produce sane caching headers so that compromises it... varnish with WP is really just moving full page cache to dedicated software
@Rarst ... tried to play around with ESI, but didn't find it to be great solution performance wise. So again varnish is only a solution if your content is pretty static ... (or you load dynamic parts via AJAX afterwards) ....
@TomJNowell there's a Debug.js object somewhere. But it seems it only replaces the content of a "post"(?) with the content of the target when you click a link... IIRC
Laps was made with custom events in mind but v1 is simply not quite good enough for flexible use. I bogged down in reusing JS from BS2, so it went on hold until BS3 fixed some things there
I am using a Woocommerce compatible theme, and I have the "Name Your Price" plugin that seems to work fine on the single-product.php page. However, I am using the plugin to sell "gift card" amounts.
I would like to add the input field and the add button to a static page in my site.
Can anyone p...
@kaiser Wasn't a comment, was part of the question...
@ChipBennett I know, I've long since ignored woo questions. But that's equally due to the fact that I've never looked at their code. I activated their plug-in once and my eyes bled purple.
@s1lv3r From the comments it seemed to be they were using it as a log for products. But I didn't care enough to look into it. Was checking for a conflict, nothing more.
@GhostToast yeah, and then wait till thousands of people use it and suddenly stop providing support and telling all people "contact rarst for support" ... :-D
I made only 2 changes, the user and pass for my mailgun account
the only difference it made is instead of saying its trying to use sendmail in an unstyled line of text, it now shows a blank screen of death and an exception stack trace
@Rarst Indeed. That's the beauty of the internet @Rarst. You don't need to know what you're talking about to talk about it. But if you want to back up your opinion, a quick Google will reveal others of the same opinion of you, and you can reverently quote them.
@GhostToast Its anything that any person might have an opinion about, with the means to voice it, but without the inclination or ability to research about it first.
Ha! Just realized that I can pull from local resources with bower. Aaaaaand already hacked Ghost to contain bower stuff. Before first page load. Great.
Ghost running. Now have to find out how to log into admin... :P
I wonder how the thing is supposed to be that easy if you ain't got node installed. People will clearly wonder how npm install --production will work on Win or Linux. :D
Public launch of @TryGhost is on Ars Technica, but this comment is the best thing about the article. http://arstechnica.com/information-technology/2013/10/node-js-based-ghost-blogging-platform-opens-to-the-public/?comments=1&post=25480465
@TomJNowell Ghost tries to access the following: http://ghost.dev:2368/built/scripts/templates.js/?v=0.3.2 - where ghost.dev just is my custom local domain.
Ehm... just saw it got a Gruntfile.js. Looked into it and saw that this is the build-process. Ran grunt ... failed. Ran grunt --force... continued with errors and warnings. Let's see where this brings me.
Yep, that's it.
Managed to get signup form. Unstyled. Managed to fire Email. Managed to gain access to admin. Unstyled. :D
Ghost tries to hide from me and blend into default browser styles.
Yeah, screen.css empty. Of course. @toscho shall I ask Frank? :)
adding images is weird, unless you know markdown and have read the initial post, there's no editing tools or hints to help you, e.g. adding an image works like this:
![some text here]
And it appears int he preview as an image upload box
WOW! Didn't know until now that searching a specific category, post type, etc. is possible without hacking into code. It's as simple as example.com/[post-type-slug]/?s=Search+Term (and similarly for category)
@its_me no, just joking. <sarcasm>it's good habit to claim ownership over any unintentional behavior which may have even remotely positive outcomes. </sarcasm>