this is a bit difficult without posting scads of code, but my question is: What are the benefits of filtering through
apply_filters('the_content', 'anything');, and given my example loop, am I filtering the_content excessively or inefficiently, or is there a better way?
I ask because I just tried the shareaholic plugin, which is supposed to detect the end of the post and insert social links. In my loop however, I find that it injects itself each time
apply_filters('the_content', 'anything'); is called, which in my case is quite a lot. Because Im new to WP and PHP, and shareaholic is an established service, I just assume these problems are due to ignorance on my part. Shareaholic has a shortcode that I can implement directly into the template, but I just want some general feedback/validation/criticism on my approach, and any ideas how to clean up or what may be causing the issue.
My loop looks something like this:
<?php /* Start loop */ ?> <?php while (have_posts()) : the_post(); ?> <?php function_for_post_banner() /* filters 'the_content' to add a post banner */ ?> <?php get_template_part('templates/loop', 'switch'); /* Switch tests for post type and applies conditional markup, handels post type media and calls 'the_content' specific to each case. */ ?> <? fuction_attachements(); /* do conditional formatting with post attachments ie images, media & docs all filtered through the_content */ ?> <?php /* End Loop */ ?>
Any advice on this is much appreciated -- thanks.