When we develop any custom WordPress theme we need to use different functions. We need to write those functions in functions.php file of the custom theme. I have prepared some of those basic functions and included in the functions.php file. I have mentioned the usage / procedure to use the function in the same file.
You have to download the functions.php file and put it inside your theme folder.
Following functions are included in functions.php file.
- Navigation / Menu
- Remove default UL markup from wp_nav_menu output
- Enable featured image with custom dimension
- Image compression while uploading
- Remove width and height attributes from inserted images
- Enable sidebar widget
- Shorten post / page title by word limit
- Shorten excerpt by word limit
- Shorten content by word limit
- Strip images from content
- Display the content of a page by page ID
- Display the content of a page by page slug
- Anti spam email shortcode inside content editor
- Change default sender email address for generated emails
- Change default sender name for generated emails
- Remove default widgets
- Remove WordPress version from Head
- Remove login error message on login page
- Enqueue script in footer
- Enqueue CSS in header
- Disable admin bar for all users but admins in the front end
GitHub URL: https://github.com/sanjaybhowmick/wp-useful-functions
Do you need a WordPress developer? Please contact us.