Template filters have to return the name of a template file, not content. Their purpose is to override template selection with a different template.
If you want to modify the content output within the content of a template, then you need to add a filter to the_content.
function my_the_content_filter( $content ) {
global $post;
if ($post->post_type == "searchable-media"){
// your code to append your meta fields to $content
}
return $content;
}
add_filter( 'the_content', 'my_the_content_filter' );
Related Posts:
- Custom Post Type Templates from Plugin Folder?
- Implementing a CrunchBase.com Clone using WordPress?
- Custom media upload content for inserting custom post shortcode
- How to Remove Certain Screen Options and Meta Boxes from add/edit post type?
- How to share category taxonomy with custom post type (The Event Calendar plugin)
- Is it possible to define a template for a custom post type within a plugin independent of the active theme?
- WP_query parameters for date range
- Use a plugin to handle custom post types?
- Register Custom Post Type from Plugin
- Updating post meta for custom post types
- Template for custom post type shows all posts instead of just one
- remove custom taxonomy metabox form custom post type
- Custom Post Type Statuses
- Custom Post Type causes Page Not Found
- add_meta_box Callback not being called
- Star rating for custom post types [closed]
- How to Make a Custom Grid View
- Get image URL from media library in input
- Way to hook into a sidebar call to replace it with a custom sidebar
- Frontend editing, Frontend user dashboard
- Override plugin with functions.php
- Should i delete the posts created by a plugin on uninstall?
- How does WP handle multiple matching rewrite rules?
- how do i remove posts from a WP_Query so the pagination is right?
- Is it possible to use WordPress as an online portfolio for text content? What kind of theme would I look for?
- Building a store locator with google maps
- How to make wp_enqueue_style and wp_enqueue_script work only on custom post type
- Correct way to make meta box with more than one meta field secure
- I want to extend the current themes’ single.php to display the meta fields of my CPT
- Plugin custom post type – Internal server Error
- How can I create a custom shortcode that will return a custom post type by ID?
- Is it possible to create Custom Post plug-in?
- more types plugin – display all post of post type on page
- When using Simple Fields plugin, how do I pull the information out of the database to display on a page?
- How to make a proper custom post type link
- Matching Chapters to a Custom posts [closed]
- auto populate list of questions if user select a category xyz
- Mq translate plugin custom post type issue
- What is the best way for showing a grid of customer logos?
- WordPress custom taxonomy not showing
- Using ACF default value to autoincrement a number field
- How to Resize the Custom Post Images?
- How to use template_include hook with form submission?
- Trying to add a page template for my custom post type from a plugin, but it will not display in the template dropdown unless file is in theme
- posts from multiple post types in one slider
- Custom Post Type – custom form in dashboard
- $pages = get_pages(‘child_of=’.$post->ID); Why arguments are concatenated?
- WP-API Custom Post Type json_no_route
- How can I list custom post type categories of portfolio
- Plugin generated unexpected output – No PHP errors
- “Allowed memory size” problem [closed]
- “After file loaded” action
- Including content from legacy app: via plugin or custom content?
- Dictionary-style definition list plugin
- Custom Post Type, Custom Columns List
- How to create repeater field manually, without plugin (ACF Pro)?
- Error Metabox Warning: call_user_func() expects parameter 1 to be a valid callback
- how to create hierachial taxonomy and manage under single post type?
- need click to clipboard button on my site
- Setting Author on CPT
- Check if theme supports sidebar
- Custom Post Type same name as Category
- Create category for each user
- Adding category base to url in custom post giving 404?
- custom post type plugin error [closed]
- How to display the custom post related blog by category?
- Undefined index: custom_post_template_present
- Problem with checked box on wp car manager plugin
- Merging new theme and plugins from development site to production
- WordPress hide post from custom post-type on a single page
- $wpdb->insert not working inside save_post tag
- Is it possible to customize a wordpress post from outside dashboard(Something like site.com/post-type/post/?e=post_id)?
- Calling an custom field from theme option at the frontend
- Array to string conversion error when trying to POST multidimensional array
- Creating themes using the one Plugin (Toolkit)
- How to add jquery to my custom post type wp plugin
- WordPress list child pages of custom post type
- WordPress custom posttype meta values doesnot save
- Assigning a custom post type to a custom page
- making a glossary with wordpress
- Create custom fields on a post
- Synch Custom Post Types (and Custom Fields, Cats, etc.) Between WordPress Sites
- get_option include in my adsense
- WordPress Custom post type won’t save properly
- How can I default a new post to being saved?
- Remove base from the custom post type URL [duplicate]
- Change the behaviour of archive cpt category and single cpt by plugin, not by theme
- A plugin for software reviews site like this one?
- Display Custom Post Type and Custom Taxonomy Data on Front End Using Only a Plugin
- WordPress show different custom post type
- Wrong block appender button showing
- Select posts from list and add them in a new list
- jet engine listing for every single taxonomy in post type [closed]
- Failed to update a post when I add a taxonomy to it
- How to add CPT in Elementor pro search template
- Remove H1 title in admin post edit screen
- How to include Font Awesome icons into ‘menu_icon’ from register_post_type() function – wp admin?
- PHP Fatal error: Cannot redeclare distance() when making a new block
- Load a custom post type template.html from a plugin
- How to make a page setting translatable in theme?