You could use add_shortcode if you want to use it within the editor.
function footag_func() {
return "Test";
}
add_shortcode( 'footag', 'footag_func' );
And then use [footag] in your editor.
Or
Use code like this in functions.php and add a conditional tag
add_action( 'loop_start', 'your_function' );
function your_function() {
if ( is_singular('post') ) {
echo 'Test';
}
}
or
Create a function in functions.php
function your_function() {
return 'Test';
}
And then use this in your template
echo your_function();
Related Posts:
- Is it possible for a plugin to register a page template file?
- Create page (not the post type) dynamically
- How to output functions from plugin inside theme
- Using a Page Template Not in Theme
- Generating Multiple Divi Pages from Database
- How do I update a field of a meta box?
- Populate editor with some content of a page with a page template
- How to add user details to different tables immediately after user registration
- mysql_real_escape_string() vs. esc_sql() in WordPress
- Custom Plugin theme filter
- Plugin generated virtual pages
- WordPress function get_the_terms() returns ‘Invalid taxonomy’ error
- Checking for existence of a page by title?
- how to get context information inside my funcion
- WordPress class, using add_action to call member function does not work
- How to modify files inside wp-includes directory in wordpress
- Fatal error: Call to a member function get_page_permastruct() on a non-object
- wp_get_post_terms Order by not working
- Inject class in body when particular page template is used
- Function/Class to list categories with checkboxes
- wp_get_theme Warning: Illegal offset type
- Why wp_die() doesn’t work with wp_redirect but exit() works
- Remove sidebar on single page using plugin API
- Warning: call_user_func_array() expects parameter 1 to be a valid callback
- Add Password Generator on password protected page
- Print Dashboard submenu name and filename
- Autogenerate a Table of Contents
- Alternative functions for mysql_free_result and mysql_ping in wordpress functions
- ECHO Executing 4 Times In Head
- WordPress pages are not published due to External database connection with WPDB class
- WordPress multisite,use same cookies across all website?
- my basic php code producing unexpected results
- Apply styles to blockquote element with the WYSIWYG editor
- Call to undefined function is_home() or any conditional tags
- unregister_setting() vs delete_option() for plugin update
- Multiple array for post_content on plugin activation
- How to change WooCommerce loop product title HTML output in single product page and archive page
- wp_schedule_event is registered but function isn’t running
- Best way to distribute templates and code accross multiple wordpress sites?
- Overwriting a plugin function
- How to list all images used on a specific page?
- Create fixed static pages
- Writing editor content to a file
- How to remove/replace current page template?
- Load php file with jquery in single.php
- Remove Permalink Meta Box not working?
- Adding tables to dashboard pages programmatically?
- Setting post_id for single.php based on URL without a redirect
- using admin functions on frontend
- Javascript Function Called Too Early in PHP Script
- Modify code for functions.php with specific twitter user url and hashtags
- can’t access some WordPress function from my plugin
- Set page to draft on plugin deactivation
- WP 3-way voting system: On to something! Please help!
- Custom Settings Plugin Save foreach checkboxes
- Customise Grouped Product display in Woocommerce with custom column
- Change the behaviour of a button
- How to create archive page to add in menu
- Load specific page when a custom URL is hit
- Can someone explain what’s the use of parse request function in WordPress?
- Add default value from selection
- function add custom fields to media gallery
- Override category archive page title (not the head title)
- Make visible page only in the trash
- Plugin frontend page design irrespective of the theme used
- Redirection from a specific page for users logged in but not with membership
- WordPress: I wanted to use Add rewrite rule multiple times for multiple CPT in my plugin
- Conditionally check if page is using template from plugin directory
- Why would one specify multiple arguments when using get_previous_posts_link() which takes only one parameter?
- I cant add is_admin control to plugin
- WordPress Ajax not returning Response
- Custom non-template page on front end fails to render
- Does hooking into a plugin action / filter override the plugin’s function for that hook?
- How to save multiple values in custom post type from front end to back end
- Remove tag from all posts when publishing new post
- WordPress plugin how to run function when button is clicked
- wp_ajax add_action fuction won’t fire on custom jQuery action
- Change Front page displays settings conditionally when user is online
- Can’t create a blank template
- Add function to Dokan ajax class
- Code to add template to page
- foreach argument to get specific file types getting too many returns
- Remove from a div by class name from post page if post author role is not administrator
- Function not working on any file other than the main plugin file
- Building WordPress Themes With Bootstrap with Adi Purdila → TutsPlus
- Page template compatibility with different themes
- Ajax not working to insert, query and result data
- How do I control the list of Pages an author can see?
- Template file structure , wordpress hook for altering the template
- WordPress permalink setting
- How can I see a varibles value when my plugin runs?
- How to add conent (text) to Add New pages form of admin in WordPress
- How can I add recent posts to menu like mashable
- auto create only 1 wp page in activate custom plugin
- Why is ‘register_activation_hook’ undefined?
- Dynamic banner for use on external sites
- How can i call from custom fields to the category editor?
- Create pages for authors
- Custom options page for themes
- Why does this fail: Disabling plugins enqueue_script() in functions.php