Be aware that a mix of return
and echo
from a function will change text positioning.
If you take this simple example :
function test(){
$the_test="test return";
echo 'test echo';
return $the_test;
}
echo test();
Whatever the place of the echoed line, this line will be always print before echo test();
because echo is called before the return $the_test;
You need to play with get_template_part and/or template_redirect action to display your content like you want.
Hope your understand what I mean and the relation with your issue 😉
Related Posts:
- Dynamically Override Fancy Title
- get_current_screen() return null
- Call to undefined function is_home() or any conditional tags
- Difference Between Filter and Action Hooks?
- Explanation of the “posts_join” and “posts_fields” filter hooks?
- How do you use the plugin boilerplate loader class to hook actions and filters?
- How do I Make a Theme “plugin-ready”?
- function triggered by “manage_users_custom_column” filter not working
- How to modify post content before writing to database?
- Determine which theme location a wp_get_nav_menu_items is for
- What’s the difference between hooks, filters and actions? [duplicate]
- How to use filter hook ‘post_updated_messages’ in coherence with action hook ‘save_post’
- Is it possible to create an action hook using do_action() within add_action()?
- Hook for post permalink update
- Define a function outside a class and call the function using action or filter hook
- Does add_filter work outside functions.php
- What function to hook for changes made in status and visibility of a post
- Synchronize Custom post type tags to WordPress default posts tags
- Woocommerce – Hide a Column in Cart Table
- Namespaced action and filter tags
- best practice for query string values – get_query_var always empty for my value supplied in query string
- Adding option to Gallery shortcode
- correct way to call javascript into hook function
- Prefixing plugin hooks (actions/filters) with a wrapper class or functions
- WordPress custom taxonomy check box to dropdown
- WordPress class, using add_action to call member function does not work
- How to get all queries’s results after they have executed?
- Remove an action by extending class and replacing it
- hook filter after the_content on a specific page
- Bind a function with its own argument to show something dynamically after every content
- Hook add_attachment error
- WooCommerce change Tax Class programmatically when Recalculating an existing Order [closed]
- Update variable value via add_filter
- Configure WordPress to Generate Scheme-less Relative URLs
- How to find list of all functions bind to a particular hook from my plugin?
- Adding tables to dashboard pages programmatically?
- apply_filters() and call_user_func() to define and call a function outside a class
- Override category archive page title (not the head title)
- Limit get_next_post to posts from the same author
- Any way, hook to add content right before the “read more” link?
- Does hooking into a plugin action / filter override the plugin’s function for that hook?
- WordPress Plugin Boilerplate – add actions and/or filters based on user’s role
- Add_action not calling callback function
- Function not working on any file other than the main plugin file
- Template file structure , wordpress hook for altering the template
- WordPress permalink setting
- How do I replace title with my plugin?
- Apply function on all action hooks?
- get_term_by() returning null on plugin
- Ninja Forms: Front-End Forms, Post ID?
- How to create an API for my plugin?
- What is an alternative method to the WordPress private _doing_it_wrong() function
- Customizing subject in comment notification e-mails
- Why does do_action pass a blank string as the first parameter if no $arg is set?
- add_filter and remove_filter added before and after wp_query
- Call activation hook multiple times
- Two-step login process – Is it possible?
- How can I hook into existing WordPress Bulk actions?
- WordPress Media mime type filter problem 4.0
- Earliest WP Hook to Safely and Reliably Redirect
- merging an array to an existing array using add_filter
- Hook into theme-switching later than `setup_theme`
- Is it possible to delay execution of shortcode output callback?
- Why my database table not created on activation?
- wp_enqueue_script + wp_enqueue_style Since When
- Act on user meta updated, but only once
- Is there any way to allow a plugin to write over a previous version?
- Event Calendar using insert_post_data after save_post and insert_post after post_transition draft_to_schedule
- Modifying meta tags after doing ajax call in plugin
- How To Change Logout Screen Title
- Passing values from a widget to a function within a plugin
- Check for template part, else filter content
- Replace youtube embed in wordpress
- How can I replace content in the WP Admin area before an admin page is rendered?
- Replace a menu with widget or a custom template file programmatically
- How to filter content for specific content variable
- WordPress function get_the_terms() returns ‘Invalid taxonomy’ error
- Valid filenames for add_action’s first parameter
- How do I access the menus produced by Dashboard > Appearance > Menus
- How dynamic action login_form_{action} is working
- How to get the post excerpt using post object?
- How to edit the Tags within the image file URLs?
- How to have different site identity logos on each page on Astra Theme [closed]
- Ajax +wordpress onClick link redirect to new page and create html content
- Adding filter to the title without affecting the menu title
- Remove Permalink Meta Box not working?
- Creating posts with links from a txt file
- Change the behaviour of a button
- Redirection from a specific page for users logged in but not with membership
- How Do I Unhook This Parent Theme Function?
- Use action, filter, or hook to append HTML to WordPress plugin function
- Plugin Development – Call to undefined function comment_exists()
- wp_ajax add_action fuction won’t fire on custom jQuery action
- get_comment_meta() for a filter hook in a plugin
- plugin not hooking to my custom hook
- Building WordPress Themes With Bootstrap with Adi Purdila → TutsPlus
- Custom signature appears twice on page
- How can I see a varibles value when my plugin runs?
- Looking for Hook that is fired after a plugin or wp upgrade is installed/updated
- Woocommerce: block user removing cart item