-
AuthorPosts
-
October 30, 2014 at 3:08 pm #343429
Hi!
Im wondering it its possible to include some code that i add manually at the bottom of every post to the loop it self so i don’t have to add it every single time a make a post. Scroll to the bottom of this post: http://www.ocreurope.com/ankle-strength/ and at the bottom of the post above the share buttons I’ve added this code:
[av_one_half first][related_posts_by_tax before_title=" <h3>" after_title="</h3> " title="You might also like:" format="links"][/av_one_half] [av_one_half]<script type="text/javascript">// <![CDATA[ google_ad_client = "ca-pub-1034185122770032"; google_ad_slot = "4271529508"; google_ad_width = 300; google_ad_height = 250; // ]]></script> <!-- POSTS - Bottom square --> <script src="//pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript">// <![CDATA[ // ]]></script>[/av_one_half] <script type="text/javascript">// <![CDATA[ google_ad_client = "ca-pub-1034185122770032"; google_ad_slot = "4329979102"; google_ad_width = 728; google_ad_height = 90; // ]]></script> <!-- POSTS - Bottom --> <script src="//pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript">// <![CDATA[ // ]]></script>
Is there a way to make it a part of the post loop?
November 1, 2014 at 6:35 am #344490Hey Swedfit!
Thank you for using Enfold.
The only way you can add the code is by editing includes > loop-index.php or use the the_content filter: http://codex.wordpress.org/Plugin_API/Filter_Reference/the_content
Cheers!
IsmaelNovember 4, 2014 at 7:47 pm #346048Can i just add the code as it is to the loop-index.php?
November 4, 2014 at 10:54 pm #346196Hi!
I would go with Ismael’s recommendation. It is cleaner and allows for more efficient theme updates if you’re using a child theme.
Add this at the bottom your theme’s functions.php
add_filter( 'the_content', 'add_after_content' ); function add_after_content( $content ) { if (is_singular('post')) { $code = "put your code here"; $content = $content.$code; } return $content; }
Best regards,
Arvish -
AuthorPosts
- You must be logged in to reply to this topic.