Tag Info

Hot answers tagged

3

As an example (adjust to suit your needs): add_action('loop_start', function() { if ( is_single() || is_home() ) echo '<div>'; }); add_action('loop_end', function() { if ( is_single() || is_home() ) echo '</div>'; }); You may need to adjust the conditional statements further if you wish to target archive pages and the like ...


2

Plugins are loaded before the theme which means that your apply_filters won't have any actual callbacks registered to it. Instead, you need to call your apply_filters sometime after the theme has been loaded. Something like this: /* Your plugin's file: */ add_action( 'init', 'my_lovely_funky_filters' ); function my_lovely_funky_filters() { /* Fire our ...


2

With the lastest version of WordPress (4.3) you can now natively remove the customizer's theme switch setting without resorting to CSS hacks. /** * Remove customizer options. * * @since 1.0.0 * @param object $wp_customize */ function ja_remove_customizer_options( $wp_customize ) { //$wp_customize->remove_section( 'static_front_page' ); ...


1

The "Weak" text is passed through _x function, which calls translate_with_gettext_context, so I would try the following: add_filter( 'gettext_with_context', 'wpse199813_change_password_indicatior', 10, 4 ); function wpse199813_change_password_indicatior($translations, $text, $context, $domain){ if( $text == "Weak" && $context == "password ...


1

There's an array option when creating a custom post type and custom taxonomy for ""rewrite"" and you can set a ""slug"" and it's there that you can change your permalink structure. For more read here. Also the other option that I get from post 1 and post 2 one helped me blink some idea. 1 Rewrite rule: You need to add a new rewrite rule so Wordpress knows ...


1

No, you cannot do that, unfortunately, because get_header( $name ) doesn't have a filter for the $name (it only passes the name with the action call). However, if you are willing to modify the header.php file for each site with something like this right at the beginning of the file: <?php if ( apply_filters( 'load_custom_header', false ) ) { ...


1

I'm listing down the necessary hooks which will add, validate the custom fields on registration form as well as allow fields update from user profile page - //show field on WordPress registration form add_action('register_form','register_form_callback'); //handle validation add_filter('registration_errors', 'registration_errors_callback', 10, 3); //save ...


1

Notice how it is singular? Comment, not comments? This capability is not designed to check if user can edit any arbitrary comment out there. It can only check if user can edit one specific comment and correct way to call it is current_user_can( 'edit_comment', $comment_id ). Unfortunately second argument is missing from current_user_can() function ...



Only top voted, non community-wiki answers of a minimum length are eligible