Here are some of the many custom changes you can implement through your functions.php. Please remember to create a child theme before installing these codes onto the functions.php file of your current theme.
To know how to create your own child theme, I recommend the Child Theme Configurator plugin.
When that is done, Activate your new child theme and Navigate to Appearance > Editor > functions.php
*** These changes would require a basic understanding of PHP coding. ***
WordPress has set a specific number of characters to appear before the Read More link, which redirects user to the post page. To override the default number, add the code below and change the number after the word ‘return’ to any whole number, then Save.
/***** Excerpt Length and Read More link… *****/
function custom_excerpt_length( $length ) {
return 50;
}
add_filter( ‘excerpt_length’, ‘custom_excerpt_length’, 999 );
To change the 'Read More' to anything you want.
function custom_read_more_link() {
return 'Your Text Here';
}
add_filter( 'the_content_more_link', 'custom_read_more_link' );
To customize your wp-login.php page. The first part of the code below is to allow to add chanes onto your style.css file while the second part is to change the WordPress logo to your own logo.
To hide dashboard elements…
/***** HIDE POSTS on WP Dashboard *****/
function remove_menu_items() {
remove_menu_page('edit.php'); // To hide the Posts
remove_menu_page('edit-comments.php'); // To hide the Comments
remove_menu_page('edit.php?post_type=feedback'); // To hide the Feedback
}
add_action('admin_menu', 'remove_menu_items');
To use your custom short-codes on any post / page of your website. In this example, we want [phone] to be the shortcode and it will print the phone number and make it clickable.
/***** HIDE POSTS on WP Dashboard *****/
function phonenumber() {
$phone = "+1 (xxx) xxx -xxxx";
}
add_shortcode('phone', 'phonenumber');
If you have questions or need any help understanding and implementing these changes, please let me know at delice@wpquicksupport.com
Post Views: 229