The markup surrounding the content is not specified by WordPress, so there is no hook for that.
But you can declare your own hook there. In your template file, write …
<?php
do_action( 'before_content_container' );
?>
<div class="main">
<?php
the_content();
?>
</div>
<?php
do_action( 'after_content_container' );
?>
… and then you can register a callback for that action in your functions.php
.
Related Posts:
- Accepted arguments value in hook functions
- Which action hook to use for function?
- Modify a function without editing template
- Override the WordPress core function wp_referer_field
- Changing where my author box is printed
- Save_post – Warning: Cannot modify header information
- How Do I Unhook This Parent Theme Function?
- Issues with title-tag and document_title_parts
- Remove Actions/Filters added via Anonymous Functions
- Define custom Page Template without its own .php file
- How to influence the information displayed on widget inside wp-admin
- Extract image from content and set it as the featured image
- How to restrict actions and filters “properly” by conditions
- Add action hook conditionally – only when home.php in use
- Using add_filter() in Widgets
- How can I tell if I’m on a login page? [duplicate]
- Convert hyphen to underscore in permalinks
- Remove Page Title from Static Frontpage
- How to hook into the quick edit action?
- WooCommerce add_action hook results in 500 error
- How to update feed only 2-3 times a week (for Feedburner email)?
- Gravity Forms field entries into wp_query loop [closed]
- How would go about if I just want a temporary function?
- Get current page_id before loop, in functions.php
- How to change the order (priority) of registered filters (or actions) (e.g. for the_content)?
- str_replace function in theme
- Adding HTML to the end of every post with the Block Editor
- Inserting a functions output after the content
- Don’t delete a page if it holds users
- How do I add Bootstrap and LESS to my migrated WordPress site?
- Passing values from a widget to a function within a plugin
- Which action does wp_update_user triggers?
- How can I get my Script to work on the Login page?
- Trigger a custom function when option are saved in admin area
- What did I do wrong in my functions code, that will not change the “Get New Password” text to “Send It”?
- Replace a menu with widget or a custom template file programmatically
- jQuery does not work
- Add Element as a Filter to the_content
- How to edit the Tags within the image file URLs?
- Can’t properly set the_title add_filter to show short_URL
- How to add_filter html template to middle of content
- (Woocommerce) Order by price when entering specific category
- Remove links from the_content when using filters wp_trim_excerpt
- Is there a way to prevent a function/method from being called outside a specific hook?
- Call to undefined function is_home() or any conditional tags
- Possible to hook into Media Library preview File column and use a custom image?
- Adding code before post title with the_title produces weird results
- Add back in child theme what the parent theme removed with remove_action
- login_headertitle is deprecated since version 5.2.0
- The_content and Preg_replace in loaded Iframe [closed]
- Is it possible to use add_filter in an included file in the child theme’s functions.php?
- Add Adsense code between job listings – wp job manager plugin
- Replace admin header logo with an image
- Changing the text of Upload/Insert on Posts and Pages Screen
- Does hook have an effect on increasing the page load?
- What is the earliest Hook a Script can use?
- custom error message for empty username and password using authenticate filter not working
- post value to function with Ajax and jQuery
- Use action, filter, or hook to append HTML to WordPress plugin function
- Remove External Links from WordPress posts Using add_filter() in Theme functions.php
- Which method is more correct for removing WooCommerce Extensions menu item?
- $content is empty while using DOMDocument
- WordPress hooks to call a function inside a construct
- Shortcode to eliminate and replace with
- previous_post_link inside of a function?
- Function the_content
- Settings in functions.php used by a plugin
- Force resize for all video content
- add query string to all pages after user logged in
- delete_term is not working properly with add_action()
- Is there a hook that I can use when a fatal error occurs?
- Function attached to cron job not running but will run if called manually
- disable a specefic sidebar when user is log out
- Remove Actions/Filters added via Anonymous Functions
- Passing a parameter to filter and action functions
- Difference Between Filter and Action Hooks?
- remove empty paragraphs from the_content?
- How to know what functions are hooked to an action/filter?
- Get a list of all registered actions
- Warning: call_user_func_array() expects parameter 1 to be a valid callback
- function to show youtube videos within excerpt – if condition and apply_filters
- HELP: Code To Check Status And Write Debug Entry
- How can I modify or filter this variable in an existing class? (Mai Theme)
- Is there any filter or action hook to remove layout classes from appearing in my templates?
- Get category of post inside save_post hook
- Ninja Forms: Front-End Forms, Post ID?
- Create section wit form
- Log in and out using custom pages, no logout confirmation and redirects for logging in and out 2023
- Copy and Modified WooCommerce function is_coupon_valid [closed]
- How to get variable from other function inside class function using add_action for Ajax call
- How can I able to exclude ‘Category’ and ‘Tag’ slug from the URL in WordPress without reloading to new site?
- get last part of page url and add it as cat in wp_query
- Redirecting after login except for a specific page
- Apply function only for specific post
- Submit CF7 form programmatically with WP-Cron?
- Overriding an existing filter
- wp_update_post breaks my function
- Add 2 links in between the navigation using the Breadcrumb Navxt plugin hook
- Modify upload directory to use post category slug in file path on multisite installation
- is there a list of actions on WordPress