I think the problem is that the PHP include()
function will output instead of return data. What you can do is output buffer the include which would look something like:
// Start buffering any output
ob_start();
// Output the include into the buffer.
include( 'horo-header.php' );
// Append the buffered output into the $content variable
$content .= ob_get_clean();
Additionally, you may want to look into get_template_part()
instead of include. For more information regarding output buffering please review the PHP docs:
Related Posts:
- Load different template file when condition met?
- How Can I Have A URL Changed Based on the Originating URL?
- Problem getting single_template filter to work – I want to serve a different single.php file for posts in a certain category
- How to add attributes to tag when template cannot be directly modified
- theme_page_templates not working
- Adding a filter to comments_template
- Change the template when the user is not logged in using page_template filter (it does not work)
- Shortcode / plugin with custom (flexible) output
- output custom Posts on a Page
- How to redirect template_directory to subdomain relativ url?
- Would like to use hook or filters to customize email templates
- How can I filter same content in page
- the_content filter not working when Jetpack activated. Any idea?
- Show child theme for users on specific IP
- if i put the code in my theme’s function.php file can it work?
- Add custom options to the wplink dialog
- How many filter/action hooks are healthy?
- Filter specific shortcode output?
- Insert new element to array with add_filter
- How can I extend the Gutenberg table block transform to allow colspans/rowspans on pasted table elements?
- get_option() filtering and getting out of recursion
- Get excerpt from $post->post_content
- How can I add information underneath the user’s name on the users.php page?
- Is calling function_exists() faster or slower that apply_filters()
- Filtered query_vars becomes global. Why does this work?
- How can I filter Microsoft Word gunk from pasted content?
- How to disable all WordPress emails modularly and programatically?
- Allow Profile HTML for select users
- Alter only the page title, not the post titles within
- WordPress 3.5+ upload tool filter
- Search with filters and title
- Use content custom filter for all shortcodes
- Filter all html output
- How can override a add_filter of a plugin?
- Return array of images after content
- failed to filter hook `get_terms_defaults`
- Nested calls the the_content filter
- Filter list by a unique meta value dilemma
- How to use shortcode attribute in separate function
- Is it possible to track down Actions and Filters?
- How to filter a wordpress core function?
- Adding id and class to the search input in WordPress search form
- get_bookmarks filter not supplying query argument (wp 3.1)
- Filter and modify entry-footer link in twentyseventeen
- Filter Posts by current Month
- Extending body classes in front- and backend
- Are there actions or filters I can use for Ajax calls?
- Correct method of redirecting user login
- How to filter for user registration, be able to throw error message
- How to create ‘Local’ filters for WordPress srcset sizes in template parts?
- No ‘Access-Control-Allow-Origin’ header is present [closed]
- Add default user field to WooCommerce checkout [closed]
- Filter to shorten column content on edit-tags.php
- Proper after_setup_theme and wp_head cleanup
- Why doesn’t remove_action work in my plugin?
- Using a filter to modify Genesis wp_nav_menu
- Filters on Login Page
- the_excerpt filter doesn’t work as expected
- How to filter link?
- Unique design inside a specific category’s url
- What is the earliest hook to modify post content?
- How to modify only part of a function through the filter
- How can I apply filters in my class that extends Walker_Nav_Menu?
- How should I be using filters and is_single together?
- How to edit embed filter for youtube video to allow responsive full width layout
- Remove get_template_part() from custom theme
- How to access page variable inside action hook
- Shorten the title length
- Hook in a sidebar widget and add some markup
- preg_match() not working with post content
- Search a title word through query_posts (not the exact match)
- Elementor Image Hover + Filter Grid [closed]
- ‘manage_users_custom_column’ is a filter, but ‘manage_posts_custom_column’ is an action. Why?
- comment_notification_text filter not working
- Line Breaks are stripped off when direction property is found
- Scanning for custom embed and prefetching
- WordPress remove_filter not working
- How to exclude or include categories in wp rest API without query parameters?
- Remove and replace woocommerce add to cart button [closed]
- Hook to change the site URL
- Replace a specific URL on all apperances on the Website (Maybe a filter?)
- Strange behaviour of REGEX in a WordPress filter (trying to suppress emtpy paragraphs)
- Modify Contextual Help
- Widget image reorganize layout
- WordPress set featured image to first image of the post
- Modify WordPress search behaviour in backend?
- Re-order search results with posts_orderby filter and post meta value
- Auto-generated excerpt with shortcode and read more button/text link
- Testing requested query in pre_get_posts
- Retrieve a custom form field modified by a filter
- Converting restricted html in comments to bbcode
- What is the proper/best way to have multiple add_filter for wp-job-manager-resume
- Modify WooCommerce email shipping text value
- Using Filters To Change Page Title
- How to add a class to Buddypress avatars in the Activity stream? [closed]
- using posts_where for meta data on pre_get_posts
- can’t output gray scaled image I’ve created using add_image_size
- How properly write function to filter content in a template for plugin “multiple content blocks”
- How to elect position of new item output in a dropdown when using add_filter
- Filter a custom post type by custom field in admin