Tag Info

Hot answers tagged

4

I am doing something like this in one of my plugins: function my_body_class( $c ) { global $post; if( isset($post->post_content) && has_shortcode( $post->post_content, 'your-shortcode' ) ) { $c[] = 'your-class'; } return $c; } add_filter( 'body_class', 'my_body_class' ); I'm not sure it was really necessary, but I ...


4

Is there more efficient ways to validate the quotes using the WordPress api? I think you should set a nonce for the form You also should check if current user has capability to save quote To get properly sanitize values form $_POST look at filter_input and/or filter_input_array I don't see performance issues on validation, but a possible ...


2

Yep, wp_trim_words(): <?php $trimmed = wp_trim_words( $text, $num_words = 55, $more = null ); ?> Or in your case: <?php echo apply_filters( 'the_content', wp_trim_words( strip_tags( $post->post_content ), 55 ) ); ?>


1

Got it, after making a Custom Shortcode (this can be found on standard WP docs), then by direct calling one of JW player's function, from the Template File, like: generate_playlist( '1234' ); It will then return a complete Array of the JW Playlist Object, so we can parse it out.


1

There are a lot of ays to do the trick, one possible is use a function that use a static variable. However, before you can be able to get the arguments set in shortcode, the shortcode must be processed... function foobar_func( $atts = array(), $out = FALSE ){ static $args = array( 'foo' => 'default foo', 'bar' => 'default bar' ); ...


1

The CSS for my parent theme (core) was incorrectly formatted. The code at the top read: Theme Name: Core Theme URI: http://www.domain.co.uk Description: The core theme. Author: Squideyes Author URI: http://www.domain.co.uk Template: Core Version: 1.0.0 Tags: clean, simple, easy The Template: tag should only appear in the child theme css. This is what ...


1

You can use the awesome WP_Admin_Bar & hook in with admin_bar_menu: /** * Add a "Log out" link directly to the admin bar. * * @link http://wordpress.stackexchange.com/q/141446/1685 * * @param WP_Admin_Bar $wp_admin_bar */ function wpse_141446_admin_bar_logout( $wp_admin_bar ) { if ( is_user_logged_in() ) { ...



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