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?
- How could I create real-time filtering in this case?
- add_action(), add_filter() before or after function
- Remove classes from body_class
- wp_headers vs send_headers. When to use each?
- Filter any HTTP request URI?
- Is it possible to filter comments in a post so a user can only see the comments they have written?
- Where to hook into post content?
- What hook do I use to edit the post statuses option in admin?
- Check if a filter or function has been already been called
- Filter Widget Title Wrap
- Customizing WordPress the_title with add_filter
- How can I send data to admin-ajax via JS Fetch?
- Disable resizing of gif when uploaded
- How to change Woocommerce breadcrumbs content?
- I’m using a filter to remove the tags auto wrap, but there still wrapped elements?
- How to prepend text to the_content, but after img/shortcode
- How to enable visual editor when editing comments on the dashboard?
- Can’t get wp_title filter working in twenty sixteen child theme
- add_action uses ‘echo’ add_filter uses ‘return’, why?
- Cron schedule interval through plugin options?
- wpmu_signup_user_notification filter not working
- How to check a filter are applied
- How do I add a listbox to the TinyMCE editor?
- How to remove google font in WordPress for only single page?
- Overwrite default WordPress wording
- Why anything done on comments_array hook gets reset?
- Using ‘posts_where’ on a query with a custom field
- Wrap h1-h6 in a div
- add filter login_redirect does not contain original requested redirect
- get_header and hook avoid normal call
- Dropdown filter in custom posts
- Custom Login Errors and variables I can use
- How to order by taxonomy using wp_query
- ‘the_content’ filter removing html tags from post content
- Feed, RSS not able to clear the cache and cannot change the limit of cache life time
- WP action/filter to modify title before header output and article output?
- Custom view counts not updating correctly
- WP Filter to change the URL of an Anchor wrapping the last gallery image
- Gutenberg – Add align controls to a custom block
- What is the filter or hook to add admin controls to posts on the front end?
- To add a custom filter based on a meta field
- How to properly modify WP Vary or any existing headers?
- Filters on Login Page
- the_excerpt filter doesn’t work as expected
- How to filter link?
- Unique design inside a specific category’s url
- Conditional does not work with add_filter
- How can I apply filters in my class that extends Walker_Nav_Menu?
- Pass debug_backtrace() in WordPress filter
- 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
- Problem with Class, Filters and Callbacks
- Renaming wordpress login and get new password button
- preg_match() not working with post content
- Search a title word through query_posts (not the exact match)
- Parse a shortcode differently based on on what it’s nested in
- Elementor Image Hover + Filter Grid [closed]
- 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]
- Replace a specific URL on all apperances on the Website (Maybe a filter?)
- How to add lazy field in content endpoint using Gutenberg blocks
- Strange behaviour of REGEX in a WordPress filter (trying to suppress emtpy paragraphs)
- Modify Contextual Help
- how to use apply filter for Class?
- Modify WordPress search behaviour in backend?
- Re-order search results with posts_orderby filter and post meta value
- ‘the_content’ Filter delivers empty string with lengh (608)
- Testing requested query in pre_get_posts
- Output dynamic_sidebar_params in wp_head
- How to sort posts according to meta value?
- Modify WooCommerce email shipping text value
- Using Filters To Change Page Title
- can’t output gray scaled image I’ve created using add_image_size
- remove_filter excerpt_more from a plugin class
- How to elect position of new item output in a dropdown when using add_filter
- Query Multiple Filters, one with Meta
- Filter a custom post type by custom field in admin
- How to change content hash value, within the_block_template_skip_link action?