Hello,
My client wants to add custom code so that it will populate all her posts. The company providing the code has given me instructions and I not sure which template file to add the code to. Can you help? I can send you the instructions so you can get a better idea of what is needed.
Thanks!
Victoria
Typically you would edit the template you’re using for your posts, like template 4 or whatever. There are two templates in the theme root, one for the loop, one for the layout, for each template type. So, you can usually test this by opening one of them and putting some text like TEST TEXT HERE in a div, then look at that online to see where it shows up.
Hi,
If you want to add a custom code to your posts, you will have to edit the post template that you use(or all style where you want to appear) like Chris suggested, please check – http://screencast.com/t/LNG4CyUKz
Thanks!
Thanks for the replies. Which template is the Standard blog post and video blog posts?
Here are the instructions I was given from the client. Maybe this will help you direct me better.
Search your theme directory for a single‐post.php template file. This file is used to render a single post. Open the code file and place the nmWidgetContainerArticle class on the root div element of your article content, above the_content() method. This will wrap your article and tell the widget to start searching for ad placements; it serves as an anchor.
Example:
<div class=”post-entry nmWidgetContainerArticle”>
<?php the_content(); ?>
</div>
Can’t find the_content() method in your code file?
This is more than likely because you are loading an external template. You can verify that you are loading
an external template file if there is a line of code similar to the following:
<?php get_template_part( ‘content-single’, get_post_format() ); ?>
Look for a file called content‐single‐{post‐format}.php where {post‐format} is the format you are using on
your posts. In most instances, the file should be called content‐single‐standard.php , meaning standard
post. Next, follow Step 1 to insert the class.
Step 2 – Insert Code
Place the code supplied to you at the bottom of the nmWidgetContainerArticle div element.
Example:
<div class=”post-entry nmWidgetContainerArticle”>
<?php the_content(); ?>
</div>
<div id=”NmWg3276″ ></div>
<script type=”text/javascript” src
=’https://cdn.nmcdn.us/js/connectiaV1.js’></script>
<script type=”text/javascript”> NM.init({WidgetID:
3276,ArticleSelector: ‘.nmWidgetContainerArticle’})</script>
I am not sure where
Hi,
The default post template is exactly in the above screenshot. Here is the content – http://screencast.com/t/dsIFrAtzgH So you can easily try to add you code there, clear cache and see how it works.
Thanks!
Hello,
I added the code to the loop-single.php file and it appears to be working but only on the posts that use the video format but not on standard posts. Which template file is used for standard posts?
Thanks!
Victoria