« first day (2175 days earlier)      last day (2769 days later) » 

12:41 PM
@kraftner sorry, I hadn't been in the room for a while so it didn't generate notification. happy to chat about Meadow.
got quoted as claiming that Composer is not right tool for WordPress on trac *slow clap*
@gmazzap this is your fault ^ :D
 
Don't worry, I'm not in a hurry. So short intro: I am sick of standard WP templating and have been looking into alternatives for quite some time now.
So looking at meadow I have been wondering about something from the beginning:
Why did you decide to intentionally just pass-through all the WP ways like the loop, inconsistent naming for template tags and generally giving up the separation between context building and templating by just passing through all functions to raw PHP. (Specifically discouraged by Twig Docs: http://twig.sensiolabs.org/doc/recipes.html#defining-undefined-functions-and
 
first Meadow is not "actually" Twig. Meadow is a Twig-based DSL for WordPress.
it was made to work like WordPress. any attempt to bolt on "proper" things on WP is either doomed or niche and non-reusable
you can work with Meadow through context separation, it's all set up for it, it just doesn't need it out of the box
 
Okay then let me reformulate that question: Why did you build meadow? What issues with standard templating does it solve for you?
 
absence of template inheritance
 
I can see template inheritance. Anything else?
:)
 
12:56 PM
ability to introduce custom abstractions for things WP has especially messed up, such as comments templating
 
How does this need a template engine? Can't you abstract that away with PHP?
 
Twig is abstracting this with PHP
 
touché :)
 
specific syntax is just matter of preference. Guiseppe used Meadow some then moved on to write his Foil thing
 
(Sorry if I'm sounding rude, I'm just really interested in how and why people approach getting away from standard WP templating)
 
1:02 PM
nothing remotely rude so far?.. but then I just had to read a trac thread... :)
 
Yeah, I'm also bugging him for his approach. :)
People can get sensitive about questioning their stuff and (see chat title) I try to be careful therefore.
 
the bigger challenge for me at the moment is how do you ship proper templating in a public plugin. huge challenge at work...
 
So your main goals were template inheritance and the specifics of how template helpers work in WP, right? Not so much separation of context building and templating or template sandboxing?
 
correct. I gave up on separation from the start. Timber was trying to do separation and we disagreed on that, I found their results clunky too. I think they later came around to my point.
for the record in plugins I do Mustache and strict separation, I like it that way when I get to build everything. themes are just too convoluted for that.
 
Timber feels really messy. It tries to do everything and feels like an octopus with its tentacles everywhere. Not feeling comfortable with that level of commitment and all-or-nothing approach.
 
1:09 PM
WP feels really messy :) hadn't looked at Timber recently, but it's quite obviously viably enough to survive and ship projects
 
Did you give up on separation because of "not needed for me" or because you just thought the way WP just is makes it impossible or too hard/not worth it?
 
both. people don't get that whole reason WP is easy to pick up is template tag API and how low tech it is. discarding it is both more complicated and having to learn/make a different way.
 
Not disagreeing on that. It is just that I am willing to learn/make a different way if there are benefits I can gain from it. Not saying this is for everyone, just thinking about me and stuff only I use.
 
if you want strict separation just try Mustache :) it's very refreshing to work with hard limitations it enforces.
 
But I already understood that you're in the "whatever works, never fight out of principle" - camp.
Yeah currently playing with Mustache, Twig and Foil.
 
1:15 PM
I can fight alright. but WordPress is very apt at bogging you down in pointless fights. if I am busy fighting WordPress I am not accomplishing things in that time.
 
Very reasonable, I'm usually in that camp too. But I guess you know that sometimes there are those phases where you feel like breaking out. And maybe all just for the sake of feeling more comfortable where you came from in the end.
 
I do know :)
 
So my main focus now is on context building. I guess you need to worry about that too when using Mustache.
 
Mustache is great for that, since it's very limiting about what can be done inside template
have to think not only about passing data, but preparing and passing logic as well
 
Do you go with e.g. WP_Post or WP_Query objects as context and handle them in the templates with helpers (more or less like you do in meadow) or try to normalize them into arrays with primitive data?
 
1:22 PM
don't remember, I mostly use in plugins so it's usually not posts
 
Because this is where I can't really decide now. The former is probably easier but drags WP-mess into the templates. The latter feels more complicated.
Okay so totally custom data structures from the plugin that don't relate to WP constructs anyway, right?
 
So when I say I'd like to try to use a template engine (no matter if Mustache/Twig/Foil) for building themes with WP and also build normalized context for them, abstracting WP away to have nice and clean templates you'd say "Good luck trying, see you in some time when you gave up and don't tell me I didn't warn you". Is that a valid summary? :)
 
yes
 
;-(
Damn. If you say that I feel inclined to believe it...
 
1:34 PM
when I felt like doing something clean and pretty I just wrote Seam :) no WP involved
 
haha, love this: "There are a lot of previously invented wheels like it. But this one is mine."
 
so we're talking about this github.com/bobthecow/mustache.php yes?
 
Among other things, yes.
 
yeah, there are some other PHP ports but that's the one I use
 
and where was an example wp mustache integration project available?
did i miss a url?
 
1:40 PM
I linked to Laps as one example right few messages above?
 
aha ok
 
But if you mean a whole WP site project the lack of such plus the question whether that is doable at all was the whole discussion. :)
 
did more crazy involved stuff though, translation was a challenge since I just wanted to use strings inline in Mustache template, but have them exported into POT with rest of WP stuff
 
Ah yeah, that is on my list of pain-points.
 
used this back then gist.github.com/Rarst/9178471
also started on github.com/Rarst/ComposePOT later but never finished since I just don't do that much i18n
 
1:46 PM
Okay thanks for your time Andrey. I've been warned now. Probably I still won't be able to resist giving it a try myself though.
 
have fun :)
need to update Seam btw, but waiting on PRs to update some service providers to Silex v2 :\
 
icc
 
icc = ?
Oh and before I forget: Congrats on the WordCamp! :)
 
thanks, ran super smooth, nothing exploded... don't want to do aaaaanything rest of the year. have to go to WordCamp Netherlands though for visa reasons.
 
So now that you finally have a proper Visa you're complaining again!?!
;)
 
1:54 PM
I am always complaining
 
Right...
Okay, need to stock up on chocolate before I head back into my futile WP with Template Engines endeavour. See y'all!
 
 
3 hours later…
5:11 PM
greetings, how are you guys turning your shortcode to HTML?? I'm playing with building a shortcode that uses tinymce and the shortcode gets entered into the post but renders as it's seen in the editor.
 
usually you pass it to do_shortcode to get the HTML output
it adds a UI for adding shortcodes to the media explorer and renders them out in TinyMCE
 
@TomJNowell ya I was looking at do_shortcode but is it typically just return do_shortcode?
 
where are you calling this?
 
I've been breaking down two shortcode plugins and that is the only area Im stuck
function shortcode_handler(atts , $content = null) {}
 
I'm not sure which API's you're relying on there
 
5:23 PM
then I see: $output = do_shortcode( $content ); with a return of $output
@TomJNowell good point, looking at: bainternet's repo
dove into is process and learned a few things just stuck on the conversion
 
you did add your shortcode handler like that add_shortcode( 'myshortcode', 'my_shortcode_handler' ); right?
 
yes
and the shortcode gets entered in the post but outputs on the site without the conversion.
 
I smell codesmells in that plugins main class
 
codesmells?
 
@DᴀʀᴛʜVᴀᴅᴇʀ you're referring to the TinyMCE view?
and yeah, calls to extract, unescaped output, defining a class then immediatley instantiating it ( impossible to test the class )
github.com/bainternet/bs3_panel_shortcode/blob/master/js/… that looks to be where the preview control is being generated
 
5:28 PM
Im refering to when the modal pops up, I enter in the data like what he did, I see a formatted shortcode that looks like [code data-foo="32" data-bar="1"] doesn't render as HTML but renders as [code data-foo="32" data-bar="1"] on the page
 
"on the page" is in wp-admin or on the frontend?
 
@TomJNowell ah, it is
frontend
 
which is itself a code smell, build JS as DOM nodes then generate a HTML string from it, or use a templating language, don't join up strings and variables to build HTML, it's a security issue
 
@TomJNowell any good documentation or Q&As to read on how to take the shortcode and convert it to HTML then?
 
it looks like it was done manually
but if you're happy with what's there, I'd just install the shortcake plugin and have it done automatically
there's a lot to be learnt from that plugin
short of a remote request you're going to have to build a javascript implementation of your shortcode if you want it to be accurate, or have a placeholder to represent it
 
5:33 PM
just wanting to learn how to build plugins and utilize them
 
I am still not sure if we are talking about the display of the shortcode in the editor or on the frontend of the website.
 
@kraftner display of the shortcode through the frontend of the site
I went through and looked for a Q&A but didn't see one
 
Ok. Because then I don't understand what Tom is talking about with js and shortcake and alike. If I get that right the shortcode is inserted into the post, it is just that you get the naked [code data-foo="32" data-bar="1"] on the frontend instead of it being transformed into actual html, right?
 
@kraftner YES
I've searched for a Q&A but didnt see one on wp.se
 
Okay so you're sure you're adapting github.com/bainternet/bs3_panel_shortcode/blob/master/… right?
 
5:39 PM
@DᴀʀᴛʜVᴀᴅᴇʀ is this in a call to the_content() that you're not seeing the working shortcode? Or are you displaying content some other way?
 
the_content
 
Okay so you took that code an changed the name of the shortcode to "code" in the js, right?
Did you also change it here https://github.com/bainternet/bs3_panel_shortcode/blob/master/GWP_bs3_panel_shortcode.php#L16 ?
 
@kraftner well I went through it and broke that down with about four others and have everything working except for the rendering on the frontend. As tom pointed out that plugin is converting it in the JS file
 
function toms_shortcode( $atts, $content = "" ) {
	return "Moomins!";
}
add_shortcode( 'tom', 'toms_shortcode' );
usage:
[tom]
 
@kraftner yes all of that is done
 
5:41 PM
result:
Moomins!
run in global scope or on the init hook
 
The first parameter of add_shortcode needs to match with the tag name. I guess you have some mismatch there.
 
the shortcode is added with: add_shortcode( $this->shortcode_tag, array( $this, 'vader' ) );
ill make it a question
 
and this happens in a class that has a method called 'vader' ?
Because the second parameter of add_shortcodeis a function or a class method
refers to
 
yes Ive went through all of that and its something else, Ill make it a question
 
ok
 
5:58 PM
Im going through and full commenting to make sure Im understanding this correctly
 
 
2 hours later…
8:26 PM
@Rarst what I did? :0
 
9:05 PM
Say I have a custom query somewhere and inside a pre_get_posts I'm using $query->get_queried_object() - - does that not work for custom queries and only the original queried object? ( codex.wordpress.org/Function_Reference/get_queried_object )
That appears to be the case anyway and I'm just trying to ensure something somewhere else in my theme isn't screwy.
 
9:19 PM
@Howdy_McGee get_queried_object() should not be used inside pre_get_posts, it's too early
 
:/ O.K.
 
You can check query var...
 
Well, I've been trying to stop query.php errors from showing up in my debug logs. Trac says it's a theme developer bug and I'm convinced it's a core bug. It has to do with conditionals being called "too early" and returning NULL instead of an expected object.
I had hoped that I could use get_queried_object() to do some predetection before it any real conditionals.
Back to the drawing board!
 
10:11 PM
@kraftner and @TomJNowell I asked the question: wordpress.stackexchange.com/questions/241023/…
 
 
1 hour later…
11:19 PM
@gmazzap me answering on that WP Starter thread was quoted as me being against Composer with WordPress :D
 
11:37 PM
@gmazzap hmm, why does wp-downloader provides wordpress/wordpress? that doesn't look good as for me, bad idea to use their namespace and it confusingly comes up in Packagist search as standalone package
 

« first day (2175 days earlier)      last day (2769 days later) »