Tag Info

New answers tagged

0

You can with filter. On your plugin : $value = 0; $value = apply_filter('get_value_from_function', $value); Then on functions.php add_filter('get_value_from_function', 'my_special_value_treatment', 10, 1); function my_special_value_treatment ($value){ return 1; }


0

You'll have to use get- and add_option inside a register_activation_hook. <?php register_activation_hook(__FILE__,'save_activation_timestamp'); function save_activation_timestamp() { add_option("myplugin_activation_timestamp",mktime()); } ?> You can find an entire tutorial on that at CodeYoghurt. It even mentions your case as an example.


-2

Zend's Z-Ray has a theme profiler. Also useful for seeing SQL queries.


0

Got it. This post demonstrates what I need.


2

Plugins load before themes. The earliest hooks available to plugins is plugins_loaded (or muplugins_loaded for mu-plugins), while themes run on after_setup_theme and later hooks. So you better just load the file [that contains the class] on a specific hook in your plugin. It probably is best to load it on a lower priority than the default 10. Below I use 5 ...


0

Plugins are loaded before functions.php. You should include the class in your plugin if possible. I have had scenarios where a class was part of the theme, but also needed in a plugin where you couldn't assume the class was included in the theme. In those cases, I simply included the class in both places and wrapped it in a "class exists" check. Like ...


0

The approach is pretty much sound, this is how these things work in WordPress. You might want to use add_rewrite_enpoint() for implementation though, since it compresses multiple steps into on integrated call and fits many use cases well.


0

I contacted Dropbox support and they came back with another method to set the key which simply involves using the following javascript call, before creating the button. Dropbox.init({ appKey: '<YOUR APP KEY>' }); I have added this to the helper script which handles the upload and passed the key down (which is stored in a standard Wordpress option ...


1

You can pass boolean false to supports to have post type support nothing at all. However note that: you might run into issues with saving "empty" posts (not having one of title/editor/excerpt) likely you still want it to support custom-fields at least, rather than nothing at all


1

<script>YOUR CUSTOM JS CODE</script> inline does the same exact thing as YOUR CUSTOM JS CODE placed in a js file. I see no problem with the use of your app key in a js file. There is a few points to consider here though If your script is dependent on the main jquery library, just remember to set the $deps when you enqueue your script, ...


1

The way WordPress uses to find a plugin in repository is not public AFAIK. As per Otto answer in question you linked it involves plugin url header alongside plugin name. BTW, remove the plugin from the list of plugin to update is the best way to ensure this problem is not going to happen again: once the matching method is not public you can't know if it is ...


0

The level of difficulty integrating your app into wordpress, will depend entirely on how modular your code is. For instance, if your code is written well enough that you can unhook certain portions of your code, such as user creation / validation etc and utilize WP'S core function in lieu of it, then your life will be relatively easy. As stated above, WP ...


0

Roughly it goes like this: You have to boot WordPress first. If you boot your app first then it won't be able to reliably boot WP core. At least in code meant for distribution. This is your main design constraint. Since you start with WP core you automatically have access to all the goodies. For things you mentioned these would primarily be all user stuff ...


0

I just got into the database after trying this myself, so beware of inaccuracies. I'm also assuming the database-prefix is wp_. What I found was that a refrence to the menu itself is stored in both wp_termsand wp_term_taxonomy. The one in term_taxonomyalso stores the number of elements in the menu. The relationships between menu items and posts are ...


0

Most of users use wp_nav_menu to output the menu in a theme, then you could make use of the callback function that is passed in the arguments array. wp_nav_menu( array( 'fallback_cb' => 'wp_page_menu' ) ); wp_page_menu is the default value for the callback function. Looking further, wp_page_menu has an exclude key in its arguments array. wp_page_menu( ...


0

Do you mean the featured image? Use wp_get_attachment_image - Here is the code that I use in my plugin while ( $the_query->have_posts() ) :$the_query->the_post(); $image_id = get_post_thumbnail_id(); $imagesize="thumbnail"; $image_url = wp_get_attachment_image_src($image_id, $imagesize, true); //do something endwhile; You can also use ...


0

Actually, just doing this check fixed this issue. if(wp_validate_auth_cookie()==FALSE) { wp_set_auth_cookie($userid, true, false); } seems to have fixed this issue. @here,your proposed solution didn't work for me and just redirected me to login page when trying to get into dashboard


2

Just as @PieterGoosen mentioned, in a deleted comment, the post types should be registered within a init hook callback. The after_setup_theme action is fired before init, so that hook will not help you. Try for example hooks fired after init, like wp_loaded. Here's for example a list of the actions order from my vanilla install.


0

After pouring all of my points into this question and trying a few suggested options it seems that WordPress can't handle one minute crons. I have changed it to 5 minutes and haven't had any issues since. A few things that I tried over the course of weeks for testing purposes: Change the hook names to not include underscores [BUSTED] Rewrite the plugin. ...


2

From WordPress point of view — not much, beyond plugin's header (and even there) it is hardly policed. From licensing point of view you obviously need to accommodate requirements of both licenses accordingly. At least — make clear that your combined work is under GPLv3 and which parts of it are based on Apache License 2.0 code. GPL site has instructions on ...


0

Revised: After adding an early test to avoid trying to re-login an already-logged-in user, I was able to remove all session and cookie handling entirely and rely on a single call to wp_set_current_user Good luck! This solves the problem for me so far and uses the new WP_Session_Tokens class to update the current user's session and token. Prior code left ...


0

Rarst - Thanks for your answer. I found that you can't add image at all to the description tab, you can add only video from youtube, vimeo or wordpress in this tab. You can add a jpg , png or gif (animated gif too) to the screenshoot section or to the banner that appear in head of plugin page. In other words you can add any type of images to files that go ...


0

While I cannot remember on top of my head live example of plugin with a gif, there are quite a few with videos and at least ones using animated PNG as header (AJAX Comment Loading). So I would say — yes you can, but no guarantee it will end up well. It's not explicitly forbidden or allowed either. :) Might be better to load gif from plugin too (like ...


-2

probably i = int a:3 = array[3] s:7 = string(7) etc


2

I have no idea why would you even want to do something like that. Lets assume that a ping time to the server is 100ms (mine is usually worse), this means that with simple AJAX that sends, wait for response and then sends again, 1M requests will take 100k seconds - more then a day. if you can send 10 at each time you will cut it down to about 3 hours but you ...


2

No, there isn't such an API, but if you'd like one you can: Build it yourself Open a ticket on WP Core Trac But putting that aside, if you need to delete, create, or update 1 million posts or something of a similar scale, doing it via the frontend is not a good thing, even with an AJAX powered progress bar. 3rd party plugins have indeed implemented ...


5

The problem is that filters in WordPress are global; if you add a filter somewhere it persists everywhere, unless you remove it. Also consider that you should prefer composition over inheritance, and if your current application structure is already built upon inheritance, and you can't or don't want to change it, you should avoid at least using filters for ...



Top 50 recent answers are included