link Does it Belong in a WordPress Plugin

To decide if a function can be included in a theme or if it must be put into a plugin depends on whether or not it is going to be a permanent part of the theme or it will not always be used specifically on the one theme. If the function changes the way the content is delivered to the page then it might be plugin territory---not styles or size, shape, form, but more position action or interaction such as form feeding etc.

Here is a list of some examples of what goes where.

Purpose of code Functionality plugin functions.php
Creating shortcodes Always Never
Adding scripts and styles Depends Depends
Creating sidebars Never Always
Creating menus Never Always
Add post types/taxonomies Always Never
Add post thumbnails Depends Depends
Add Google Analytics to footer Always Never
Customize WordPress Dashboard Always Never
Change default Gravatar Always Never
Add custom profile fields Always Never

Also for reference - here are the list of included wp_head order of priority which are default actions by WP core on load - initialization. (not on topic but found while surfing (not on a board but on the Internet...lol)) A lot of posts on this blog are more for developers and may have odds and ends added to the post.

add_action( 'wp_head',             '_wp_render_title_tag',            1     );
add_action( 'wp_head',             'wp_enqueue_scripts',              1     );
add_action( 'wp_head',             'feed_links',                      2     );
add_action( 'wp_head',             'feed_links_extra',                3     );
add_action( 'wp_head',             'rsd_link'                               );
add_action( 'wp_head',             'wlwmanifest_link'                       );
add_action( 'wp_head',             'adjacent_posts_rel_link_wp_head', 10, 0 );
add_action( 'wp_head',             'locale_stylesheet'                      );
add_action( 'wp_head',             'noindex',                          1    );
add_action( 'wp_head',             'print_emoji_detection_script',     7    );
add_action( 'wp_head',             'wp_print_styles',                  8    );
add_action( 'wp_head',             'wp_print_head_scripts',            9    );
add_action( 'wp_head',             'wp_generator'                           );
add_action( 'wp_head',             'rel_canonical'                          );
add_action( 'wp_head',             'wp_shortlink_wp_head',            10, 0 );
add_action( 'wp_head',             'wp_site_icon',                    99    );

if ( isset( $_GET['replytocom'] ) )
    add_action( 'wp_head', 'wp_no_robots' );

Also here is a snippet to  get rid of those annoying emoji scripts in the head of your theme.


function disable_wp_emojicons() open brakcet

// all actions related to emojis
remove_action( 'admin_print_styles', 'print_emoji_styles' );
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );

// filter to remove TinyMCE emojis
add_filter( 'tiny_mce_plugins', 'disable_emojicons_tinymce' );
}
add_ action( 'init', 'disable_wp_emojicons' );

function disable_emojicons_tinymce( $plugins ) {
if ( is_array( $plugins ) ) {
return array_diff( $plugins, array( 'wpemoji' ) );
} else {
return array();
}
close bracket

    Write a Reply or Comment

    Your email address will not be published.


    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>