May
17
comment Registering AJAX callback function that is part of a class without instantiating the class in function.php
@AndrewBartel Helps avoid variable conflicts. I can always use $my_class = new my_class; within a function and be sure that scope of $my_class remains within the function.
May
17
accepted Registering AJAX callback function that is part of a class without instantiating the class in function.php
May
17
comment Registering AJAX callback function that is part of a class without instantiating the class in function.php
Yeah, this definitely is more of PHP stuff, but I was looking for an answer in WP context. Moving the hook outside of the class was first thing I did earlier. But my bad, I was missing the quotes around the class to treat it as a string. I need some coffee now. Thanks for the help. Much appreciated.
May
17
comment Registering AJAX callback function that is part of a class without instantiating the class in function.php
Where does the hook go? Does it go inside of the construct in the class or outside of the class? Doesn't appear to be working for me.
May
17
asked Registering AJAX callback function that is part of a class without instantiating the class in function.php
May
17
accepted PHP json_encode and XSS
May
17
comment PHP json_encode and XSS
@thiefmaster Yeah, this is a gray area where I really cannot do something to prevent things from going wrong due to bad implementation by others. I thought may be I was missing something. Thanks for the clarity.
May
17
asked PHP json_encode and XSS
May
15
comment Reduce number of SQL queries inside WP_Query loop to fetch author data
@DiH This is what I had tried: $users = $wpdb->get_results("SELECT * FROM $wpdb->users INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id WHERE ID IN (" . implode(',', $post_authors) . ")");
May
15
comment Reduce number of SQL queries inside WP_Query loop to fetch author data
@DiH Well, you are on track. I did try my hand at building a custom SQL query to using INNER JOIN on users table and usermeta table and fetch results for all users at once. But somehow this only returned one row (last inserted) from usersmeta table for each user.
May
15
asked Reduce number of SQL queries inside WP_Query loop to fetch author data
May
13
accepted How to track pageviews without thrashing the MySQL DB
May
9
comment Adding admin-ajax.php to the frontend. Good or bad idea?
@toscho This works. I was missing the trailing slash. I have permalinks set to /%postname%/
May
9
comment Adding admin-ajax.php to the frontend. Good or bad idea?
@toscho I added the rewrite rule as per your suggestion but example.com/ajax URL 404's. Could you elaborate on where exactly within the .htaccess should I add this. I have it currently between # BEGIN WordPress <IfModule mod_rewrite.c> and </IfModule> # END WordPress
May
8
accepted How to implement Progress Bar and Callbacks with async nature of the FileReader
May
8
comment How to implement Progress Bar and Callbacks with async nature of the FileReader
Just few minutes back I implemented this same solution and came back to this question to find that you happened to suggest exactly what I implemented. For the progress I do not need granular values. So I ended up calculating the progress as var progress = parseInt( ((loaded / totalNumberOfFiles) * 100), 10 );. Thanks for the help.
May
8
asked How to implement Progress Bar and Callbacks with async nature of the FileReader
Apr
26
comment How do I use global variables to access plugin methods in jQuery?
@billyonecan Both are within the same $(document).ready(function().
Apr
25
comment How do I use global variables to access plugin methods in jQuery?
@billyonecan I haven't tested this with fiddle. However, this problem is not just with a single plugin. All plugins that I have loaded on the page, exhibit the same problem.
Apr
25
asked How do I use global variables to access plugin methods in jQuery?
1 2 3 4 5