This is not quite simple (as copying and pasting into new functions.php :D), but you can create a plugin that will load this every time.
A (very) good and simple guide can be found here.
Addition by Original Poster (johannes)
I created a plugin for that:
-
I created a simple php file and put it into
wp-content/plugins. It looks basically like this (i.e. it contains the plugin name, description, author etc. and the function I want to use in my site across all themes):<?php /** * Plugin Name: Function-Includer * Plugin URI: my URI * Description: my description * Version: 1.0 * Author: johannes * Author URI: my URI */ [... code of my function ...] ?> -
Then I went into the WP admin backend, to the plugin page, where that plugin is listed as “Function-Includer” and activated it.
-
Done – the function is available everywhere in my site now.
Related Posts:
- How to enqueue script if widget is displayed on page?
- Why I can’t add a CSS style in this WordPress theme?
- The difference between calling wp_enqueue_scripts to load scripts and styles in custom theme
- Is there a way to set the order of wp_footer hooked functions?
- What can I hook into after_setup_theme?
- What does “Do not deregister the jquery script in the administration area” mean?
- How do you enqueue script tags for ReactDOM in WordPress’ functions.php?
- using wp_enqueue_script to attach jquery-ui
- Enqueued Stylesheets Effecting Admin Styles
- wp_enqueue_script being ignored in custom theme
- Getting jquery to work with custom theme
- Is it safe to enqueue a font style without putting http or https?
- Adding wp_enqueue_media(); causes problem
- Is there a filter for enqueue script to strip the type=”text/javascript” property
- Including Javascript options
- Is my approach to enqueue styles inefficient?
- functions.php not hooking up with style.css
- How to To Filter wp_enqueue_script() Scripts on Some Pages
- How to add Bootstrap Tour JavaScript to WordPress Admin Panel Dashboard Widget
- Difficulty loading jQuery with wp_enqueue_script
- jQuery not available to other scripts
- Can´t access child theme´s scripts dependencies found in parent
- How to modify default controls in WordPress theme customizer
- How to enqueue javascript for WP Customize options sidebar?
- Enqueued JavaScript is not working
- Overide enqueue in non plugable function via child theme
- How to register and enqueue JavaScript files without breaking plugin dependencies?
- How to fix : Uncaught ArgumentCountError: Too few arguments to function? [closed]
- How to enqueue a script which is type module without using script_loader_tag filter?
- Custom jquery not code not working in wordpress
- add jquery file if a certain page is included
- Adding google fonts to WordPress theme
- how can i remove js file from my footer in wordpress
- Find out the reason that the Styles and scripts in the theme are loading properly in localhost but Not in server after deploying
- Enqueue script for development purposes only?
- Correct was to customise theme using get_theme_mod in scripts
- how can I re-utilize and class on a child theme
- How do I get my theme scripts to load in a custom theme built from Bootstrap
- enqueue script if page is not equal to
- Theme now uses require.js and enqueue script no longer works
- Enqueue script/style with multiple GET parameters
- how to create a conditional content_width for a wordpress theme?
- Modular theme settings
- How to determine the current widget’s parent container (sidebar widget id)
- Comment form not display properly?
- Setting up partial Right-to-Left admin interface
- Moving functionality from functions.php to classes?
- Is it possible to display the admin bar while in the Theme Customizer?
- Custom nav menu is created with default pages, but not hooked to theme’s custom menu location
- How to pass code from header.php to footer.php
- Move my theme style.css into a folder
- Demo Import changes terms ids
- how to change WordPress menu markup/classes
- Best practices: Custom theme sidebar menu – hardcode or widget?
- Is it a good idea to make whole theme widgetized?
- Gutenberg Reusable Block as part of WordPress Theme page
- How to get the URI to a theme without the domain. Example: /wp-content/themes/my-theme
- A mystery 300px image size
- Switching theme only changes style sheet being used
- Is function_exists() considered a good practice when using 3.0+ functions?
- Can I have a widget and sidebars in custom theme?
- WordPress theme switcher
- How can I wrap html around the output of the_time function?
- Problem with empty class attributes when running a filter on nav_menu_css_class
- WP_bootstrap_Navwalker_issue [closed]
- Adding custom class to get_avatar() image doesn&https://wordpress.stackexchange.com/https://wordpress.stackexchange.com/#39;t work
- Q: How to pull data from custom table to populate zustomizer setting/control select options
- Make custom CSS changes and use built in theme customizer later?
- The ‘default’ attribute from $wp_customize->add_setting() method not in db?
- How to Find the Page the Front Page is Using?
- My jQuery is enqueued properly. So why isn’t it working?
- Database Tables in WordPress Theme
- 3 Level Deep Navigation Menu Not Showing All Levels
- Call to require(‘../../../wp-blog-header.php’) results in 404 error?
- Random white space before doctype
- is_single() works in plugin, not in theme?
- Do I need to create a child theme for JointsWP
- why mytheme/single-product.php works but not mytheme/woocommerce/single-product.php
- theme-independent CSS/JS files
- What is the need for the static front page [closed]
- Do translation functions like __e() have to take strings in English in themes?
- License of the used Bootstrap Theme is not GPL compatible
- How add built-in textarea in theme development?
- Pagination fuction in shortcode always displays on top
- How to include posts with a theme
- Why I can’t load my JavaScripts using an hook inside my functions.php file?
- Pagination don’t work with active filters
- restrain filter on get_the_excerpt to queried item in stead of current post
- Theme has disappeared
- Alt header logo and link for specific pages
- Custom php template file only for mobile
- which template should I use for single category post?
- annoying “Confirm Form Resubmission” message
- image sizes – finding and removing
- Make page accessible from another URL
- Any way to permanently translate themes?
- Fallback dosen’t work when not using ‘menu’ attribute
- issue displaying variations in custom template using WPeC 3.8.9.2
- How to save checkbox choice in wordpress
- How to disable edit link button bottom of the page for all users except Administrator