You can define your function in the file function.php and use it later in your theme.
Related Posts:
- Using classes instead of global functions in functions.php
- Change admin bar to default:off
- When to use esc_url, esc_html, esc_attr, and friends?
- Can’t change theme name
- When to use is_home() vs is_front_page()?
- Get the blog page URL set in Options
- Function to return true if current page has child pages
- What is the difference between wp_register_sidebar_widget and register_widget?
- Display random categories on the front page (Finding and Editing Theme Functions)
- What are the ADVANTAGES of ORIGINAL wordpress template structure?
- List of all theme customizer control types?
- Create “File-less” Page Template in Functions.php
- How to change admin bar color scheme in MP6 / WP 3.8 front end?
- Template for individual post designs
- How to edit bbPress template files – WordPress + BuddyPress + bbPress? [closed]
- Best practices – Should I create a child theme vs. customizing a framework theme? (such as HTML5 reset)
- How can you develop on a live WordPress installation that is using W3 Total Cache? [closed]
- How to disable 3.1 “Admin Bar” via script for the admin user?
- What is the best practice for customizing a plugin’s JavaScript/jQuery?
- How to change post thumbnail title and alt attributes to post title?
- Why might $input (Settings API) be coming through empty?
- Set the transport of the Customizer ‘header_image’ core setting to ‘postMessage’
- Override default cropping in WordPress [duplicate]
- Get password when user registers and save it sha1 into database
- Front End Post Submit Form
- How do I “unhook” / de-register jQuery so that it’s not called as part of wp_footer();?
- Removing the default sidebar from admin panel
- Feature Survey – What would you want in a resume theme?
- Merging PHP download script into `functions.php`
- How the WordPress sidebar works
- Is there an error in get_the_tag_list()?
- Should we localize custom-made themes / plugins?
- Change loop order via form or link (jquery, not URL)
- Extend walker – navigation, adding data attribute to a tag
- How can I remove the Static Front Page option from the Customizer
- Returning Variables back into a template
- Set front page as static page [closed]
- How to programmatically bring back “excerpts” field in post editor in WP 3.1+
- How can i customize the comment list
- Allow users to add custom functions to wordpress theme
- Change date number to another language/script?
- How should I store global information such as a phone number so that it is editable through the CMS?
- When developing a distributable Theme, does it HAVE to be “inheritable”?
- How to handle theme customization and sass variables
- wp_enqueue_scripts not called on search page?
- wp_head() not inserting the default stylesheet style.css
- Upgrading a custom theme through the Dashboard
- Nesting Functions within Functions
- Is using eval() ok in this scenario
- Custom php page in WordPress theme?
- First completely customized theme, where should I start?
- WordPress how to override function adjacent_posts_rel_link_wp_head() in link-template.php the correct way
- Theme Customizer not loading
- Responsive Images – Generating multiple images from Theme Customizer control upload?
- How to retrieve an image from a post and display it before excerpt of a post? [duplicate]
- Modify Javascript Configuration Options for Theme Customizer Colour Picker
- Best practices: Custom theme sidebar menu – hardcode or widget?
- Can’t access WordPress functions in file called via Ajax?
- Best approach to create sites with Modular Content? [closed]
- Modify the Additional CSS section (adding a disclaimer)
- How can I customize wp_footer, where is the code that controls what this function does?
- What’s the best action to use when you want to do something only once per theme setup?
- How to list all images in uploads directory except those that are attached to any post
- Version control for both Vagrant config and themes being developed [closed]
- More than one meta field in a single meta box?
- Customizer API and add_panel(). Panel doesn’t show
- Is there a theme function for is_password_protected()?
- How to correctly add JQuery in a WP theme?
- how do you create an admin interface in plugin for your theme
- How to determine which custom header image is being shown
- Creating multiple hooks for theme
- What is the best way to handle multiple calls to get_template_directory_uri() and similar functions?
- Toggle Sidebar Display
- Override the filter from plugin in child theme
- How to call custom function from functions.php in site-wide template files?
- Why is the Links Manager visible?
- How to store functions in… functions.php?
- Unhook jQuery from WooCommerce via `functions.php`? [closed]
- trying to use wp_handle_upload with ajax
- Best way to start becoming a wordpress developer
- How to add a second stylesheet to the editor
- Removing non native customizer settings from a child theme
- How to reorganize the items returned by wp_list_comments()?
- Should I use include or load_template for including shortcodes, plugins and so on?
- which is the best way to customize nav-menu-template.php?
- Check if home.php and set home.php as page_on_front
- Where should I update_options in a theme?
- WP 3.1 upgrade breaks AutoFocus+ theme
- Create another “Display Site Title and Tagline” checkbox, “Header Text Color” setting and control
- Displaying recent post excerpts on static front page
- is_customize_preview() like function to check if Customizer “Live Preview” in JavaScript
- Converting HTML Template to WordPress Theme
- Customizer: Unique identifier that distinguishes which image upload control is uploading an image
- Conditional statement to show pagination
- How to make theme elements customizable in wordpress?
- How to create a custom template to admin dashboard
- Should I use add_filter for functions in function.php of the theme?
- after renaming my wp-content folder, how do I upgrade my wordpress version?
- How do I Add images uploaded in the post to a default custom field
- How to add a button which saves the post then executes a function