I’m trying to create an advertisement block to be placed on a single post (single.php) such that the div class or id is left aligned and the post content wrapped around it. I checked the single.php and this is the only piece of code I notice is what displays the post.
<div class="entry entry-content">
<?php the_content(); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'themejunkie' ), 'after' => '</div>' ) ); ?>
I tried adding the code both above the ‘entry-content’ div and also after the_content, but with both methods it either displays the div either at the beginning or at the end of the post content.
Can someone tell me which files to look into in order to add this?
You have to put your advertisement block just before
<?php the_content(); ?>
in a separate div-layer and add some css to it. E.g.single.php
CSS
Why not just hook into the
the_content
filter hook, and append your code tothe_content()
? e.g.:You may need to make the function a bit fancier than this, but this should convey the general idea.
Using the example to add classes to p tag & h2 tag.