Tag Info

New answers tagged

1

To add a checkbox you need to use the add_meta_box function, with this you can create a metabox for the new post screen. You have to create a function that generates the checkbox element, and that's it. You can use the action publish_post to call the services you need when it happens, you have other options, like save_post. It really depends on how flexible ...


1

You can trigger your web-service-calling code by using this: http://codex.wordpress.org/Plugin_API/Action_Reference/publish_post You can add a checkbox using this: http://codex.wordpress.org/Function_Reference/add_meta_box


5

TL;DR: No, you can use save_post. Unless you consider programmatic modification of only metadata "modifying a post". There (theoretically) is a way of modifying a post without triggering the save_post action hook: Direct modification of the database. But for one no plugin or theme author in his right mind would go that route and for another it would ...


4

Revisions to me are useless and just fills up your db with unnecessary "posts". It might be useful to others though. Revisions are created each time a post is revised/updated. This just holds an archive/copy of the post before it was updated, and gives the user an option to restore the specific post to an earlier time. This works exactly like any system ...


0

Quick and dirty CSS fix I came up with for Twitter oEmbed (.entry-content is specific to the theme): .entry-content > iframe { margin: 0 auto !important; } Seems to work, YMMV.


1

You can try this one: /** * Fires as an admin screen or script is being initialized. * * Note, this does not just run on user-facing admin screens. * It runs on admin-ajax.php and admin-post.php as well. * * This is roughly analgous to the more general 'init' hook, which fires earlier. * * @since 2.5.0 */ do_action( 'admin_init' ); if you need ...


2

No extra code needed. Simply include the timestamp parameter onto the YouTube link, with the format of hash t equals number m number s. Or in other words: #t=1m02s The numbers are minutes and seconds. Example of a rickroll pre-fast-forwarded to 1 minute in: http://www.youtube.com/watch?v=dQw4w9WgXcQ#t=1m0s YouTube's oEmbed endpoint seems to handle this ...


0

That file didnt work for me I had to it in wp-includes/pluggable.php if ( isset( $atts['message'] ) ) { //$message = $atts['message']; $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); $subject = str_replace("[".$blogname."] - ", "", $subject); $subject = str_replace("[".$blogname."]", "", $subject); }


2

Use the filter hook bp_members_signup_error_message Try: function signup_error_change( $error_message ) { $error_message = str_replace('<div class="error">', '<span class="val-error">', $error_message); $error_message = str_replace('</div>', '</span>', $error_message); return $error_message; } ...


0

Replace the function into your functions.php file - function update_dynamic_select() { update_post_meta($_POST['aid'], $_POST['field'], $_POST['value']); echo $_POST['value']; die(); } Replace options in your HTML part - <?php $val = get_post_meta( 104, '_image_matmenys', true ); $s1 = ($val == "10x10") ? 'selected="selected"' : ''; $s2 = ...


1

I'm guessing the built-in template_redirect action is the best for this... :D http://codex.wordpress.org/Plugin_API/Action_Reference/template_redirect


0

Use a hook that fires later and add the $bp global to the function. Try this: function bp_password_beefing() { global $bp; if ( !empty( $_POST['signup_password'] ) ) if ( strlen( $_POST['signup_password'] ) < 6 ) $bp->signup->errors['signup_password'] = __( 'Your password needs to be at least 6 characters', 'buddypress' ); } ...


0

This worked for me. function override_parent() { remove_action( 'init', 'mc_projects', 0 ); } add_action ('after_setup_theme','override_parent');


0

Let me start by saying that the init action is called when WordPress is loaded, before the tests are run. So it you are having your plugin/theme loaded with WordPress (by hooking into muplugins_loaded, for example), the register_my_type() method should be getting called, if your constructor is being called before init. (If you aren't loading your plugin that ...


0

Ok, I reworked the whole thing because I was obviously printing out my info prior to where I should have. It now looks like this: //SHOW SCREEN IF OPTION CHECKED add_action( 'admin_notices', 'sbah_show_current_screen' ); function sbah_show_current_screen() { $screenoptions = get_option('sbah_options'); ...


0

You can try using hook the validate_password_reset to validate password. Following code can be used to validate alphanumeric password. add_action('validate_password_reset','wdm_validate_password_reset',10,2); function wdm_validate_password_reset( $errors, $user) { $exp = '/^(?=.*\d)((?=.*[a-z])|(?=.*[A-Z])).{6,32}$/'; ...


0

Unfortunately I can not leave a comment to the accepted answer ... but $colorpicker_l10n is missing the current value. It should be this: $colorpicker_l10n = array( 'clear' => __( 'Clear' ), 'defaultString' => __( 'Default' ), 'pick' => __( 'Select Color' ), 'current' => __( 'Current Color' ), ); Other ...


0

You will have to use wp_footer action for that. And check your pages in functions itself to perform some specific tasks. something like this. function my_footer_function() { if ( is_page( 1032 ) ) { // Do this } elseif ( is_page( 1033 ) ) { // Do that } else { // Do something else or nothing } } add_action( 'wp_footer', ...


1

admin_url( 'admin-post.php' ) is the non-ajax version of admin_url( 'admin-ajax.php' ) Similar to admin-ajax.php it will fire one of four hooks: Logged out users admin_post_nopriv_{action} ($_REQUEST['action'] specified) admin_post_nopriv (no $_REQUEST['action'] specified) Logged in user admin_post_{action} ($_REQUEST['action'] specified) ...


1

The $hook_suffix global (copy of which you are getting passed to the hook) doesn't go into such detail. However there is plenty more of context to check. In modern WP versions bulk of it is via get_current_screen() which returns WP_Screen object with plenty of stuff (in this case you would want to check id and post_type properties likely). As for post's ...


0

Ok. Then you can use template_redirect hook and wp_is_mobile() conditional tag. wp_is_mobile() will work on device only. If you resize the window then it will not work. Now you can try this kind of code in your functions.php file add_action('template_redirect', 'redirecting_to_mobile_site'); function redirecting_to_mobile_site(){ if( wp_is_mobile() ){ ...


2

The dashboard_glance_items filter is only useful for modifying the extra elements. The posts/comments data elements have already been displayed. Here are three ideas: Method #1 - Use the dashboard_glance_items filter: You can use the following filter setup, to remove the posts/pages/comments elements from the output of wp_dashboard_right_now(). The ...


3

Unfortunately, there is no 'filter' to remove or edit the previous items in the 'At Glance' box. EDIT I removed the "Wordpress Core Hack" part because I don't want to encourage such a behavior, and I don't want you to edit the code every time Wordpress releases a new version :) And here is a code to append custom post types stats without being clickable : ...



Top 50 recent answers are included