What filters are applied to the_content function?

the default filters are set in /wp-includes/default-filters.php; for ‘the_content’ this is from line 135: add_filter( ‘the_content’, ‘wptexturize’ ); add_filter( ‘the_content’, ‘convert_smilies’ ); add_filter( ‘the_content’, ‘convert_chars’ ); add_filter( ‘the_content’, ‘wpautop’ ); add_filter( ‘the_content’, ‘shortcode_unautop’ ); add_filter( ‘the_content’, ‘prepend_attachment’ ); to trace the individual functions, you could try and use http://phpxref.ftwr.co.uk/wordpress/nav.html?_functions/index.html then follow the links… Edit Missed … Read more

How to remove the Theme Customization Button from the dashboard and themes options page?

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’ ); //$wp_customize->remove_section( ‘title_tagline’ ); //$wp_customize->remove_section( ‘nav’ ); $wp_customize->remove_section( ‘themes’ ); } add_action( … Read more

What difference does it make if I use index.php as HTML wireframe versus writing each main template file as a full HTML document?

Option 2 is the best option. To know why, one needs to look at the template loader. (The template hierarchy means nothing, if you do not know how it really works or come from) if ( defined(‘WP_USE_THEMES’) && WP_USE_THEMES ) : 59 $template = false; 60 if ( is_404() && $template = get_404_template() ) : … Read more

Can I make plugins required?

One way is to use TGM, as Bhupen already mentioned. But if you want to do it in a cleaner, more “wordpressy” way, then you can: 1. Use, but don’t require You can write your theme in such way, that it doesn’t require given plugins, but it uses them if they’re available. Good example of … Read more

Customize WordPress>Error Page

You’re probably talking about theming wp_die(), which is the function that produces those grey error pages with a white box of text in them. For a plugin solution, you could try this plugin, which says it does what you want. Not sure about version support though–it says it only works up to 3.1.4. For a … Read more

Auto get_header and get_footer on every template?

Looking at wp-includes/template-loader.php … there seems to be a way: if ( $template = apply_filters( ‘template_include’, $template ) ) include( $template ); You could hook into that filter, handle the including in a callback function and return FALSE. Sample code, not tested: add_filter( ‘template_include’, function( $template ) { get_header(); include $template; get_footer(); return FALSE; });

How to add a checkbox element to attachments editor with example

Set the ‘input’ to ‘html’ and write out the html for the input: function filter_attachment_fields_to_edit( $form_fields, $post ) { $foo = (bool) get_post_meta($post->ID, ‘foo’, true); $form_fields[‘foo’] = array( ‘label’ => ‘Is Foo’, ‘input’ => ‘html’, ‘html’ => ‘<label for=”attachments-‘.$post->ID.’-foo”> ‘. ‘<input type=”checkbox” id=”attachments-‘.$post->ID.’-foo” name=”attachments[‘.$post->ID.’][foo]” value=”1″‘.($foo ? ‘ checked=”checked”‘ : ”).’ /> Yes</label> ‘, ‘value’ => … Read more