« first day (1192 days earlier)      last day (4051 days later) » 

00:11
-1
A: Display random page

Gareth GillmanTry adding the page ID into the content e.g. the_content($post->ID);

I have no idea how someone comes to such a suggestion.
@toscho random answer generator?
oooh those
I suppose there's uses
 
3 hours later…
03:25
Just made my first patch for trac using Git. I hope it worked
04:24
I have no hope, but I self nominated because 4 candidates were too few ...
@G.M. Wohoo! Finally. :)
@G.M. Appreciated. :)
04:52
3
Q: How to load wp_editor via AJAX

user17108Does anyone know how o load wp_editor via AJAX in WordPress? My markup and editor is getting loaded properly but editor controls are not getting loaded properly, it may be because Javascript is not running in AJAX call. Any help would be appreciated.

I solved that.
But … my demo code contains 7 classes and three interfaces. Should I post that much code or rewrite it to a dumbed down version?
@toscho I think you can. The way the theory can be explained better is the preferred way of answering - as I believe. :)
@MayeenulIslam most of the code is for the options page I set up for the test
@toscho So, what do you think?
@MayeenulIslam I put the complete code to GitHub and use an excerpt in my answer.
@toscho That's good too. Thanks.
 
2 hours later…
07:04
how do I give access a page secured via login cookie (invoice) to cron function?
07:56
you mean remote page? add cookie to http request
not remote but in same site.. I guess I should just create another function which generates the html from given post object. Most of the time I think too complex.. :/
 
2 hours later…
10:18
anyone know good csv parser?
10:37
there's built in PHP Core functions for that
11:12
I am trying to scrap and parse this file but solution to the similar problem doesn't work
11:31
have you tried str_getcsv?
yes. used wp_remote_get() and str_getcsv
tried in my local (windows) and on server (linux) with same result. But on some online parser it works
@Sisir for Gists: Use valid filenames (no spaces) and an opening <?php tag or select the language from the drop down.
ah.. okey..
done
get it to working without str_getcsv() but without HTTP API.
 
1 hour later…
13:20
been struggling to figure out what's going on
14:05
while voting happens can we see who's in the lead or do we have to wait till the final close for results?
final, complex math
@toscho it's more like 565 eligible user, but I agree the rate isn't good - what a understatement..
@ialocin conversely there are 32015 ineligible users
14:20
@GhostToast indeed :) I was personally a bit surprised about the overall distribution of reputation per user, thought there must be a lot more with more reputation, but to be fair I never took a closer look before
1271 potential voters
@TomJNowell how much reputation you need for that?
@TomJNowell cross-reference that score with users who have been active on meta within the past month
and you'll find the real voting pool!
hmmm Im not sure of the data SQL for that
14:32
I kind of want to nominate myself now, but the caveat is, I just don't know if I'm able to be as active as needed, because I might be on the road for some time this year
out of 32580 total
1.8%
I was doing the same, but for last access since 1.1.14, then there are 547
what's needed to get the 100 rep bonus on joining new exchange sites?
@TomJNowell i think its having over 200 on any other site
14:46
does anyone know if those numbers are particularly wpse specific?
they are
note you can choose the site to run it on in the top right
@TomJNowell I'm a little confused on your question, although it reads perfectly fine, what exactly are you having trouble with? Are you not able to declare two inputs in a control successfully? Just asking because I work with the customizer in our app...
@userabuser it doesn't work, it's not clear how it should work either
e.g. there's a settings parameter when registering a control, and you can tell it which setting you are talking about when using $this->value() and $this->link etc
yet when I use it as it appears, they both return blank empty strings
no saving on modification etc
I might aswell have copy pasted an input from a different website
if I don't pass a setting in via value or link it works
but that gives me a single input in my control
I need multiple inputs
I know, I guess I wanted to have the answer the lazy way
besides that, if I'm not mistaken, the numbers aren't the same on all the sites, I think at SO you need 3000 for nomination
300 for nomination
14:58
@TomJNowell We just loop through an array of controls, using add_section, are you doing this or similar? Or have code on hand?
yes, I should've made clear that was referring to stackoverflow, stackoverflow.com/election/4
@userabuser so you have multiple controls?
yeah, in a section, e.g. two inputs and a textarea and so forth
=/ That's already an option I know how to do, sadly this would lead to a very long and repetitive customizer list
it also introduces new problems
control Bs contents depend on control As
and it's a suboptimal UI
Easy google fonts somehow manages it
in a section is an option to configure a font
dont think I follow what you really want
15:01
you expand it and you get font family/weight/size etc
so the contorl is not weight or size
it's a control for a heading that contains a weight and size and family field etc
TYpography is the section
and not all font families have the same weights
yes but that section contains font chooser controls
not weight controls and family controls and size controls
each choice has a single control with multiple inputs
you're suggesting multiple controls with single inputs
that's the problem
how do I do the first?
are you using add_control()?
yes, I wasn't aware there were other ways
"Nominations close in 4 hours."
15:08
@TomJNowell Well, there isn't afaik, Easy Google Fonts is just looping over an array of controls and using add_control to add them to a single section.
...this is what we do.
@userabuser it isn't
an Easy google font control contains tabs and each tab has controls
I see no means of nesting like that
if you do, add it as an answer
well, what they are doing is a little tricky... out of the box the customizer API does not support that...
instead what they are doing.... is simply instantiate a control building on add_control
which you can too... this is how they piece together custom controls with custom markup/nested/tabs etc...
I know how to build a custom control
that's not the issue
they have a whole set of views dedicated to just opening and closing custom containers
I don't know how to build a custom control with multiple inputs
15:15
$wp_customize->add_control(
	new EGF_Font_Control(
		$wp_customize,
		$option_parameter['name'],
		array(
			'label'    => $option_parameter['title'],
			'section'  => 'tt_font_' . $option_parameter['tab'],
			'settings' => 'tt_font_theme_options['. $option_parameter['name'] . ']',
			'priority' => $priority,
			'option'   => $option_parameter,
		)
	)
);
afterall what's the point in having a custom control that adds tabs if there's only a single item that you can put in there?
...this is how you would do it.
pass an instance of your custom control class to add_control
you've just posted code I've already seen but I understand nothing more
I already have a custom control
The problem is not adding a custom control
it's how do I put multiple inputs inside
I know you do but what I am saying is that type of thing is enitrely custom, you need to follow the logic of their EGF_Font_Control class.
which I don't understand
I know it's custom
but how do I do it?
E.g. a render_content method that has 2 textboxes not 1
how do I make them both work
i can make 1 work, how do I make 2 work
public function render_content() {
        ?>
        <label>
                <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
                <textarea rows="5" style="width:100%;" <?php $this->link(); ?>><?php echo esc_textarea( $this->value() ); ?></textarea>
        </label>
<?php
}
how would I add a second textarea in that method?
15:20
Simply add it...
yes but HOW
That's what I do
are you calling the method?
customizer is calling it
that single textarea works
but what do I do to get a second?
Yes but you must extend WP_Customizer with your control builder class
I can add a nonfunctional dumb textarea
15:21
then pass instance of your control builder to add control
@userabuser you keep telling me this, I already know this
I have a working custom control
passed in via add_control
it saves, it updates, it works
it only has a single html input
i need it to have multiple html inputs
how do I modify my custom control accordingly?
If I put in a text area afterwards it won't have the necessary stuff, it'll show in the customizer, but it will be useless, it won't save, it won't update
where do I get it's value from?
what about the link() method? how do I differentiate them?
add_control( new Toms_Controll_Builder($args) );....

inside

class Toms_Control_Builder extends WP_Customize_Control {
public function render_control() { /*etc... do your thing */ }
}
I know that
=s
now im confused
but that's exactly it
yes but you have it in your head
I do not
15:24
Ok...
lets take a step back
/*etc... do your thing */
Lets say for example the following...
WP_Customize_Control doesn't have an add_control method
add_control( new Toms_Controll_Builder($text_input, $textarea) );

Say for example each variable you pass to your class constructor represents a field you want in the given control...
Sitll not grasping what you mean, and that control builder has invalid construction parameters
15:27
Each argument (field) is an array of properties that within your Toms_Control_Builder, you manipulate to build the control how you want... Since you have two controls, a text input and textarea in this example, you process those fields and pass them to render_control()...
yes but how?
you're talking at a high level
I don't know how to translate that into code
but how what? that's up to you how you want to do it... your class should have methods that enable you to wrap the controls with containers/divs/styles etc
ok hold on then
I dont care about divs etc, I only care about inputs, and making sure they get values and update/save
When you extend WP_Customizer_Control things like $this->label, $this->id are now in scope!
So within your render_control() method, you have those available to show the correct values of the field...
yes but thats fine for a single input
I cant just copy paste the input a second time though
15:38
I just nominated myself.
Lets have some primaries! 4 more hours, 4 more nominations!
@TomJNowell Yeah but they're only storing their values in a hidden input, serialized or the like then iterating over those results to build the custom output in the form of multiple controls... Alternatively you can do the same but with an array key for the name attribute name="control[]"... on load, you iterate over the $this->value and distribute results accordingly to each field
so they dont use multiple inputs
they use a single input which holds serialised data that fills the other inputs
?
Well they do BUT they are multiple hidden inputs
yes...
15:42
=s how do I do multiple hidden inputs?
Just do two inputs with an array key name attribute, dump the result of $this->values in your render control method to see the data, you'll see that accessing your results is as simple $this->values[0] ...etc.
Assuming you only have two inputs per control...
@TomJNowell e.g.
$wp_customize->add_control( new Toms_Control_Builder( $fields) );

class Toms_Control_Builder extends WP_Customize_Control {

    public $html = array();

    public function __contstruct( $fields ) ) {
        foreach($fields as $field)
            $this->build_field_html($field);
    }

    public function build_field_html($field) {
        //do your custom control modification here, or call additional wrappers depending
        //on your field array parameters, etc... No limits as to what can be done.
Does that help any?
15:57
ish
doesnt the custom constructor create warnings/notices/errors though?
by passing an instance of your class?
no...
@TomJNowell I lied, Easy Google Fonts, is using more than just hidden inputs, however the same applies... The example above is a 30,000 foot view of exactly how you would do it. EGF just have a lot more complexity, but that's due to their requirements. Your class will have its own complexity based on its use-case. Principle still applies.
I use exactly the same approach and my class is very very basic, I have nowhere near the complex requirements as EGF, but its easy to inject any kind of UI wrapping your fields that you need. If you need tabs, simple, inject the markup, enqueue your JS library and custom JS file to work on the DOM elements you've inserted into the control.
modified my own code, and it gives me two textboxes, but modifying them doesn't indicate to the customiser that anything has changed, so there's no method to save
So when you save, nothing happens?
once i figure that out, I can do whatever JS trickery with tabs and custom UI etc I need
I cant save, the button isn't clickable
it jsut says 'saved'
modifying other fields changes it back to 'save and publish'
but not the ones in my control
doesnt sound like its picking up the changed event for you
try with two text inputs, then enter a value... does the save and publish button then become active?
16:07
that's the purpose of $this->link from what I can tell
I have 2 text inputs currently
using a modified version of what you posted further above
yeah you need the data attribute
data-customize-setting-link="fieldname"
use the $this->link
@userabuser was visiting your profile.. no location info. only info is about sea shells :)
@Sisir would you like to buy some? I sell them.
where would I get fieldname from?
should be $this->id
16:10
but that's the same for all inputs is it?
sorry just try, $this->link()
ya.. probably when I visit your beach..
you dont need to manually set the attribute
@Sisir private island prob
@Sisir I'm in AU
16:12
grr damned link method echos not returns
@userabuser too far from here.. I would like to visit europe first..
@TomJNowell try get_link()
yeah got that bit, now Im tryignt o figure out why its complaining with an error Fatal error: Call to a member function check_capabilities() on a non-object in htdocs/wp-includes/class-wp-customize-control.php on line 160
austria and australia should be forced to use 3 letter abbreviations methinks :D
@GhostToast there should be different ISO code for two letters.. there are also 3 letter ISO codes..
16:17
@Sisir i know. i had to look it up. AT is austria AU is australia. united states has its own problems with 2 letter abbreviations being confusing
@TomJNowell not sure, but i'd just dump from within that method to check where its failing
on permissions or whether its the control setting
for states
@userabuser I wass pasisng in '' as settings in the constructor, back and working now, except modifying the inputs doesnt trigger the js event for the update
that's with the data attribute
@TomJNowell I guess you're searching for some UI element trickery that's commonly called "chained selection", right?
hmm the data attribute isnt in there =s
16:19
oh
@kaiser the dropdown 2 depends on dropdown 1?
not quite
that assumes I have inputs I can modify and save
@GhostToast AUS = Australia and AUT = Austria ... soooo obvious.
that's a further step
@TomJNowell yes
@TomJNowell no
right now I don't have reliable modification and saving of basic inputs
and It's necessary for what I need
16:20
so much chat messages.. looks awesome!
wether I use chained selection or not
@TomJNowell You select something in drop down/select el 1 > select element 2 appears showing options depending on selected in element 1.
@kaiser yes this is what I was hoping for part of my control UI, but it's not the entire thing
else I would have a dummy dropdown, and a single working dropdown and filter the values via JS
eventually I could have 3 or 4 inputs to control
some mutually exclusive of others
0
Q: Removing unanswered questions

sriOften, we come across questions that do not have answers or more than a few comments for the question. Sometimes it seems like they are abandoned even by the user who asked the question. So in those circumstances can we not delete the questions and make the website look less cluttered? Is it bei...

@kaiser was the 2 letter ones that made me have to look it up
16:23
@TomJNowell nope. doing AJAX calls.
that's another way to do it
but that still doesn't give me multiple working input fields that can be saved independently of eachother
I'm doing it with the NDC-public-facing-sister-plugin of Filterama.
@TomJNowell sure it does. at least in a normaly form. not sure what the customizer does. haven't used it in a while.
@kaiser it doesn't, I need multiple inputs, regardless of type or eventual UI
just give the selects an id and a name...
chained selection is only part of the intended control
16:26
@TomJNowell ok. then I still don't get what you're trying to do. maybe you need a MS-Paint mock-up that you can show around...
e.g. a dropdown for Mr/Mrs/Miss/Dr/etc and a textfield for firstname, and a field for second
in a single control
rather than 3
what do you mean by "in a single control". please use full sentences :P
a single add_control() from customizer API
Each section in customizer can have multiple controls, but Tom is talking about multiple controls within a control
The only way to do that is to create a custom control instance passed to add_control()
where you define the controls layout in render_content() inherited method
a single customizer control
containing multiple html inputs
and your problem is that it doesn't pick up the content of any ui el after the 1st one upon saving, right?
16:33
at the moment it doesnt pick any of them up
guess it's confused. maybe expecting string and retrieving an array?
now that the data attribute is back
it works
but not quite how expected
typing in box 1 adds and saves as expected
however as I type, box 2 is modified to have the same value
that sounds like a JS problem
hadn't you got some gist as example of that?
if, then pls link it. I'll take a look.
16:39
@TomJNowell I distinctly remember a snippet of JS that rewrote our data attributes to the field id="name"
actually that might even be in one of our class methods
(V) (ಠ,,,ಠ) (V)
@TomJNowell looking at it... btw: class inside function O.o
@kaiser I know, irksome
but it's what Otto suggested
bah
no point
16:50
Otto... can be shortend to: O.o
defined at the bottom of the file in an if statement means the class isn't declared when I try to instantiate it, messy
@kaiser lol
@TomJNowell ehm... wat?
Do NOtto put your classes inside a function
@kaiser I know, ghastly, it's all because of an attempt to only load the customizer classes when needed
when the file is loaded the customizer classes the class depends on don't exist yet
16:53
yeah... one class, one file. remember? ;)
but when the hook is fired, they do
so load when needed. not just stuff yet another class in a single file.
also gists, gists, gists, gists, gists
single file example
even gists can hold multiple files.
I know, but effort
16:53
come ooooon, Tom! :)
when I have a working case I will simplify and refine
until then pedantry is being restrained
that and slight mind frazzle atm
n/p ... it's such a day: rainy, dark, mood dropping and smile draining.
17:12
what was the jquery plugin name that reduce the font size when browser resizes? useful for text logos not brake to multiple lines..
17:22
what happens when I star a repo on github? is it like bookmarking?
@Sisir yes
@Sisir also that dev gets a sticker next to his name for that day
I've used Fittext before... mixed results, nice plugin though
@GhostToast you've missed the entry of our sixth moderator candidate
@ChipBennett i've got a sore throat, can you fill in for me? :D
17:29
@GhostToast I'm not sure I can quite do your announcement comments justice ;)\
ok i'm on it
@ChipBennett thanks for the heads up
@GhostToast did my best
thanks!
wonderful, refreshing, and adds to authenticity somehow
but ya, caught flu on thursday. sucks
@GhostToast hope you feel better soon!
17:48
thanks
guessing primaries will be skipped?
18:14
@GhostToast looks it
you should still be able to follow the election, we'll just need to wear macs to shield us from the flem
18:45
@TomJNowell I'm back at looking at your thing. Can you find the declaration of WP_Customize_Control::$type? Hitting "Goto declaration"/"Ctrl + B" in PHPStorm doesn't show me anything. Is this intended to get set by the extending class?
mpf... TomJNohere.
i should photoshop an image that is the rest of @TomJNowell 's face so i can stand next to him in this room and look like his face
lol
19:04
@kaiser sorry my sister came round
to be fair I'm inclined to remove that variable, not sure how it got there either
@TomJNowell It seems to tell how to render_content() a control for the main function. Still it's mainly there for a very stupid reason: "Extendibility". The main class has text, select and dropdown-pages (iirc). And other core classes have upload or image. Seems that it's there so extending classes can inherit the builtin markup. Not really useful imho...
ooh the switch case in the parent class
the whole settings array hints that you pass in via the settings arg an array of settings, and then pass in a setting name via link and value
yeah. that one switches on $this->type. wasn't sure where it got set. but it's just a "variable used as constant" without any sort of setter or getter
I tried that route though, it has to be a string, a setting object breaks the code
and any parameter i passed when I tried into the value etc methods returned ''
let's get back to the drawing board: your desired result is just a chained selection, right?
19:14
it's just multiple inputs in a control
chained selection is step 2
with what purpose?
there are other parts of the control that aren't chained selection
font selection
so font -> weight is the chained selection part
but there are also others, text transform etc
colour etc
Well, have you already taken a look at Site Title & Tagline?
It got a section labeled "Tagline" that is input (text) + Checkbox
class-wp-customize-manager.php on L#714: register_controls()
hmm doesnt have a checkbox here
$this->add_section( 'title_tagline', array(
	'title'    => __( 'Site Title & Tagline' ),
	'priority' => 20,
) );
# (...)
$this->add_control( 'blogname', array(
	'label'      => __( 'Site Title' ),
	'section'    => 'title_tagline',
) );
# (...)
$this->add_control( 'blogdescription', array(
	'label'      => __( 'Tagline' ),
	'section'    => 'title_tagline',
) );
# (...)
// Input type: checkbox
// With custom value
$this->add_control( 'display_header_text', array(
	'settings' => 'header_textcolor',
It's 2012 theme (iirc) that has that section. Guess every theme has that one.
19:20
that's still adding two controls to a section calling add_control() twice
yeah, twenty twelve
@userabuser jup
@kaiser hop on skype?
wat?
hop = jump, get on
k. but only shortly. need to take a nap.
@GhostToast online.
19:33
AHA
		$wp_customize->add_setting( $this->name, array(
			'default'        => $this->default,
			'type'           => 'theme_mod',
			'capability'     => 'edit_theme_options'
		) );
		$wp_customize->add_setting( 'moomins', array(
			'default'        => $this->default,
			'type'           => 'theme_mod',
			'capability'     => 'edit_theme_options'
		) );
		$wp_customize->add_setting( 'papa', array(
			'default'        => $this->default,
			'type'           => 'theme_mod',
			'capability'     => 'edit_theme_options'
and in render_content :
$tests = array(
					0, 'testfield',1,'moomins',2,'papa'
				);

				echo '<ul>';
				foreach( $tests as $value ) {
					echo '<li>'.$value.' -- ';
					$this->link( $value );
					echo '</li>';
				}
				echo '</ul>';
gives:
0 -- data-customize-setting-link="testfield"
testfield --
1 -- data-customize-setting-link="moomins"
moomins --
2 -- data-customize-setting-link="papa"
papa --
And it works!!!!
thought you were already doing that?
but finally, great!
nooo I tried it but it didnt work
because i was expecting the setting names to be the keys
not array indices
damned lack of documentation
stupid API decision
could always do array flip
19:46
shouldn't have to
sorry to have been a pain before
not a problem at all
votes cast
mentioned it on IRC and company internal
WordPress @StackExchange Moderator Election Voting begins! Vote for me!! http://wordpress.stackexchange.com/election?cb=1 #wordpress
0
Q: 2014 Moderator Election Q&A - Questionnaire

Grace NoteIn connection with the moderator elections, we are holding a Q&A thread for the candidates. Questions collected from an earlier thread have been compiled into this one, which shall now serve as the space for the candidates to provide their answers. Due to the lack of submission count, we have sel...

 
1 hour later…
21:10
Damn it... @TomJNowell I made a mistake. I edited your answers to the "desired format". Now my face is shown at your answer - confusing and stupid. Could you file any edit so it goes away? Sorry.
21:36
Composer ticket on trac is such a mess :(((
again.
@kaiser saw it
fixed
thanks
@Rarst bpetty is being annoying, gah, i like the note on composer opening up things to non developers
I was happy with ticket on ice. as I said many productive things happened on topic outside of it and none inside of it

« first day (1192 days earlier)      last day (4051 days later) »