Add the snippet below to your themes functions.php file to get an excerpt of a WordPress post by ID
function get_excerpt_by_id($post_id){
$the_post = get_post($post_id);
$the_excerpt = $the_post->post_content;
...
Sunday, April 10th, 2016
Add the snippet below to your themes functions.php file to get an excerpt of a WordPress post by ID
function get_excerpt_by_id($post_id){
$the_post = get_post($post_id);
$the_excerpt = $the_post->post_content;
...
Sunday, April 3rd, 2016
This snippet will make the WordPress search function only return items that are a single post type. (posts, pages, custom posts types)
Just add the code below to your themes functions.php
function SearchFilter($query) ...
Saturday, April 2nd, 2016
Add the snippet below to your themes functions.php file to remove ALL of the widgets from the WordPress admin dashboard.
remove_action('welcome_panel', 'wp_welcome_panel');
function remove_dashboard_widgets() {
global $wp_meta_boxes;
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_activity']);
...
Thursday, March 3rd, 2016
Add the snippet below to your themes functions.php file to remove the version number in the WordPress admin footer.
function hide_version_number() {
remove_filter( 'update_footer', 'core_update_footer' );
}
add_action( 'admin_menu', 'hide_version_number' );
Thursday, November 19th, 2015
Add the snippet below to your themes functions.php file to make the site name link on the WordPress admin header open in new tab.
function wp_admin_bar_site_link( $wp_admin_bar ) {
$node ...
welcome to the eudemonics blog ...
you can find posts about the things i've been working on, useful code snippets and articles relating to my interests.
comments can be left at the bottom of each post, if you wish to contribute to an article please get in touch.