Reputation: 2399
How can i wrap the post content in custom div in my wordpress website?
This is from the single.php
file :
<div class="entry">
<?php the_content(''); // content ?>
<?php wp_link_pages(); // content pagination ?>
<div class="clear"></div>
</div><!-- end entry -->
I can't just put div around the_content()
function because i have some plugins (Related posts and social sharing plugins) that append content to the the_content()
function so if i put DIV around the function it will not work like i want because it will wrap also the plugins content. How can i achieve this?
Any help/ideas appreciated.
Upvotes: 0
Views: 3311
Reputation: 12391
You can add a filter on the_content
. Put this in your function.php
.
Note that, the add_filter
function has a parameter priority
, check this link.
function my_content($content) {
global $post;
return '<div class="myWrapper">'.$content.'</div>';
}
add_filter('the_content', 'my_content');
Upvotes: 2