« first day (2446 days earlier)      last day (2498 days later) » 

10:27 AM
Good morning! Does anyone know how to use the dollar sign instead of jquery in wp? I've seen a method that makes it possible to use $ inside a function, but not outside.
it was something like function($){}jQuery;
 
(function($){})(jQuery)
What this basically does is create a self-invoking function that gets jQuery as its parameter $ so that inside the function $ === jQuery
 
i new about jquery(document).ready(function($){}) but not this. Can i also define the function's name? such as (function example($){})(jQuery)
 
Well then it doesn't work like that. But more like:
function example($){};
example(jQuery);
But keep in mind that this is NOT the same as using jQuery.ready() because it doesn't wait for the DOM to be loaded.
 
so i have to pass $ to the function? what if i'm already passing an event like function(event)?
it's annoying since i have 2 billion calls to jQuery. my whole js file is like jquery jquery jquery
 
You nest everything inside that function:
function($){
function foo(){
$.whateverJQueryFunction();
}
}
You should read into function scope in JS to really understand that.
 
10:41 AM
I don't need the functions to be available before the DOM is ready. so i can define my functions inside jquery(document).ready(function($){}) and have access to $?
i read a couple of articles, want to confirm it though.
dont wanna write 2000 lines and then suddenly figure out it was done all in the wrong way :(
 
Read "Aliasing the jQuery Object" on api.jquery.com/ready
 
is this also safe? var $ = jQuery.noConflict();
 
Depends on where you use it. Inside a function yes.
 
was hoping to use it in the first line of my js file :D
 
You shouldn't write anything in global scope anyway. Wrap the whole file inside a self invoking function:
(function(){
//All your code here.
})();
This way you don't pollute the global scope.
 
10:47 AM
Grazie! almost got it.
 
 
2 hours later…
12:27 PM
@Rarst So I seem to have stumbled across some kind of weird core bug. Only for the "after_setup_theme" hook WP_Hook::current_priority() returns false even though we're definitely inside the hook and XDebug confirms WP_Hook->current_priority === [0=>20]
 
cool. :)
 
Yeah...very...
Also I don't get why there is the WP_Hook->current_priority property when the WP_Hook::current_priority() does not use it anyway and sticks with array pointers instead...
 
not sure that's the case, but do you happen to add hooks within hook? that drives it nuts.
 
Wasn't that basically the reason WP_Hook got introduced to make this finally work?
 
ha
 
12:31 PM
Still hoping it is something I fucked up because I'm too lazy to try this in a fresh site... :)
 
can you make a snippet to reproduce without laps?
 
Okay it seems to work on a fresh install. Damn it.
add_action( 'after_setup_theme', function(){

global $wp_filter;

$filter_name = current_filter();
$filter_instance = $wp_filter[ $filter_name ];
$priority = $filter_instance->current_priority();

if( false === $priority ){
echo ":(";
exit();
}

});
 
can't reproduce
 
Yeah, something in my setup. Sorry to bother you.
 
no worries :) I like to eyeroll at all the hook bugs
 
12:42 PM
:)
You've got any experience with internal array pointers or a good resource? PHP docs aren't really helpful.
 
nothing comes to mind, just mess with it case by case
 
Yeah just a pain to debug because WP_Hook is called like thousand of times all over the place...
I should probably just drop this. :) God damn curiosity...
 
just figure it out, you’ll feel better :)
 
1:04 PM
So you were right after all. Hybrid Core adding hooks in the very same hook.
 
told you :) been there, done that.
I don't think just Hybrid was enough last time, was several pieces of code interacting etc etc
 
1:58 PM
God damn it I thought this is why WP_Hook was built to fix nesting behaviour...
Nobody ever tested adding a hook inside the same hook!!?
add_action( 'after_setup_theme', function(){

add_action( 'after_setup_theme', function(){}, 10 );

global $wp_filter;

$filter_name = current_filter();
$filter_instance = $wp_filter[ $filter_name ];
$priority = $filter_instance->current_priority();

if( false === $priority ){
echo ":(";
exit();
}

}, 0);
 
2:14 PM
this is my old ticket, will try to re-test later today core.trac.wordpress.org/ticket/27428
says it should be fixed, but still open
 
I think I'm almost there. https://core.trac.wordpress.org/changeset/39430 seemingly didn't consider this "edge case" so resort_active_iterations() doesn't reset the array pointer of WP_Hook->iterations but only of $this->iterations[ $nesting_level ]
Currently trying to make this into a proper ticket...
 
2:54 PM
Seems like your issue is unrelated.
Here is the ticket in case you feel like having a look at it: core.trac.wordpress.org/ticket/41185
 
3:25 PM
im somewhat confused why people reference questions on WP.SE but then ask a question on SO..
 
Either it isn't a WP specific question - then it makes sense.
Or they think egoistically that SO is busier and they just want an answer fast - not so great.
 
3:43 PM
0
Q: WP REST API orderby meta_value

Daniel McFarlandNeed to be able to sort the results of a REST API custom post query by a meta value. Having difficulty doing so. I have made my post type available to the REST API and can order by the Date, Title etc... But when I try the Post Meta it doesn't work. Have added the following code to try and en...

 
That seems to fall in the second category...
 
so that wouldnt be in scope?
 
 
1 hour later…
4:53 PM
I must have triggered one of the users that i voted to close their question. Got a serial downvote on my questions today :)
@DᴀʀᴛʜVᴀᴅᴇʀ Hi! check this question, the accepted answer is funny. wordpress.meta.stackexchange.com/questions/4394/…
like a billion people recommend WPSE, and a hero rises to offer SO and his offering is accepted :)
 
5:15 PM
lol, I get why he does it. more views, more robust answers BUT that doesn't mean they are technically accurate but then that could be said about WP.SE
 
exactly. No one even bothers to leave a comment on SO.
I actually terminated my SO account a couple of month ago.
 
I only wish I could get more answers on questions. It's like some questions just have one answer yet there is a multitude of ways you could do something
 
any of your questions are remained unanswered?
 
but birgir's answer was correct about the tag box...
 
5:21 PM
just look at my questions. I'd love to see more then 1 answer on a few but I also with always mark an answer as accepted when it has a code example.
ah, havent gone back to that. I have a rule, I wait two weeks for all answers before accepting anything out of fairness but I try to always upvote answers. Like yours on the update post.
 
for example my biggest issue and concern is security, with this: wordpress.stackexchange.com/questions/268233/…
 
i thought u could since u fixed the related one
 
I should go back and answer that this weekend.
 
I use the exact thing for my theme's options. but i only add the ID of the ad, not the whole code.
for example, the google analytics code rarely changes. So i add the code to the footer and only replace the ID that i have sanitized and saved in DB.
 
5:29 PM
this one is almost a year and I'm surprised I never heard anything: wordpress.stackexchange.com/questions/233091/… I've debated taken questions down with no answers that are over a year to SO but I really feel the WP site should be supported. Since there are more "why this doesnt work" I try to ask questions that make me wonder
 
LOL not even a comment?
 
@JackJohansson I actually made this a settings in my last theme.
 
when your website is in maintenance mode, a file is created in your wp folder
it stays there until the process is over
you can check to see if that file exists.
the file's name is .maintenance
 
6:01 PM
okay... so random. is half the secure web broken today?
Having problems with SSL connections from MULTIPLE sources today.
big places too like Google and Facebook
 
 
2 hours later…
8:01 PM
Kaitlin Pike on June 27, 2017

If you go anywhere on stackoverflow.com today, you’ll notice a brand new footer, new About pages, and possibly a few other surprises we’re still testing out (not everyone will see these yet).

Back in February, we updated our top navigation, and today’s changes follow in the footsteps of this effort. We wanted to make it easier for developers to find what they need so they can learn, share, and build their careers. We also needed to make our company information more accessible to press, and to surface our product offerings for customers. …

 
 
1 hour later…
9:30 PM
@JackJohansson an answer!! lol thanks.
why does the WordPress API confuse me so. . .
 
@DᴀʀᴛʜVᴀᴅᴇʀ Youre welcome! what are you confused about?
 
you're** lol
 
sorry xd
 
building a bot that will populate info for a site, but the ingestion approach is somewhat confusing to me. I've done it with twitter but that was based on the twitter JSON I was able to pull. I thought about delivering to a cron or a sub-directory hidden but actually getting it there is questionable.
 
are you trying to scrap some contents?
 
9:42 PM
I can already do that and I store that locally
 
So what's the problem?you have the data, and you have the filters
 
getting data from A -> B
 
aren't they already sorted?
 
well they are items I sell, I scrape the comment feeds to a local folder and run bash to manipulate their input but Im unsure if I should build everything into JSON and run a local CRON that would push to input to the site.
 
I think it's time to ask on WPSE with some examples. You made me confused too :P
 
9:46 PM
all good.
Still working on the tag metabox and testing locally
 
blame birgir if it doesn't work :)
 
10:00 PM
see, that is why I always like more then one answer ;)
 
another answer on your question?
 
no, so testing how I should hook into it safely
 
by using safety goggles.
 
poor a little of this, poor a little of that; waaallaa
 
pour** lol (my turn)
 
10:06 PM
yikes, developer error, my poor bourbon wont pour in the glass correctly
 
payback dude, payback! I'm trying as hard as possible to sail against the "Where humor doesn’t work." but it's not easy.
 
got to have humor in code. I once wrote an app that echo'd star wars lingo since the guy I had to deliver to was too lazy to do anything and didn't care much for star wars.
 
If i don't make fun of everything while coding, I'll go crazy instantly. Already too annoying to handle codes.
 
@JackJohansson I think others are crazy here too.. just wont admit it, lol
 
It took me like a year to make one of the mods here laugh ( at least as text ). Everyone is serious here, idk "why so serious".
 
10:15 PM
because code is serious work....
ive also wondered if that is there as a pun..
 
yes it's serious. But aren't we already serious in the Q&A?
 
10:27 PM
must be why we are the only ones talking O_O
 
yea it's mostly me talking to myself, good that i have an audience .
 
It's like : Hello someone design a cart for me plz ty
actually used to do this some times...
 
no, its like, I found the solution I need but to cheap to spend 17 dollars on it.
 
It's quite interesting to me. People who don't spend, usually gain less.
and they assume they are a winner!
 
10:37 PM
I think what really bugs me is how to get AJAX to work on WP.
 
Have you considered using a REST-API endpoint instead of admin-ajax? ( @TomJNowell )
I usually leave this comment under my "own" AJAX questions, since i know he will otherwise :)
 
Trying to understand, performance wise, how infinite scroll works in WP and why jetpack seems to be the only liable solution
 
what so hard about it? just request the next page and use jQuery.append to add it to the list
TADA
 
from a scraping perspective doesn't infinite scroll help? and is it really defaulted in the theme?
 
not good for scrapping or SEO. Search engines don't follow it obviously
 
10:45 PM
see that is one thing Ive wondered and will look at webmaster to see if someone has asked about it
 
don't need to ask... it's obvious mate
If search engines do it, they will go into an infinite loop
also infinite scroll demands viewport checker, which i doubt if it's supported on search engines
 
man I spend a ton of time wondering about web rendering
 
what aspect of it?
 
like very large image based wp sites and clients who always seem to want you to make a super fast site on shared hosting =P
 
what aspect of it?
connection dropped sorry. i'm exactly developing one
will show you after it's finished. took me 1 damn year to optimize it.
 
10:56 PM
@JackJohansson I wrote an app that optimized my images then resizes them for a site.
 
now imagine you are making a theme, consider images sized from 100px up to 40mp
handle them with WP
 
if your server has imagemagick no issues.
 
wp will just throw error after error in your face
this can't be found, that can't be saved, those are ugly i don't like them, this image is spooky i can't upload, bla bla.
WordPress is just the worst platform in the whole world when it comes to photography.
 
err.. I've had goodluck with it but then I blow away the set width and height in the code and then come back and compress all images
 
the problem is that WordPress offers nothing for photos, it's all about content...
just 1 checkbox for year/month organization :D
 
11:03 PM
but isnt photos content, lol
 
sorry i mean text :D
afvan!
 
ah, then do what I did. I played with a theme that would pull from an API, save to the post and use lazy loader, never really finished it, but it was interesting
 
but what if the customer wants to upload?
 
sell them an app that will compress before upload =P
thats what id do
only if the hosting provider doesnt have imagemagick or allows it
 
when it comes to marketing, you have to even consider that an ape may buy your theme
need if(ape) too.
that's not a host... that's a waste of money :D
this guy ruined my socratic badge. Need to find him and dowvote the crap out of him.
 
11:22 PM
@JackJohansson huh?
 
i think one of those whom i voted to close his question, is seeking revenge on me. beating the crap out of my questions by downvote.
 

« first day (2446 days earlier)      last day (2498 days later) »