Can't get wpp_post filter to work
-
Hi, I can’t get the wpp_post filter to work (as shown here: https://github.com/cabrerahector/wordpress-popular-posts/wiki/3.-Filters)
I’m using the wpp_get_mostpopular template tag like this in my functions.php for the homepage:
echo wpp_get_mostpopular('limit=1');
Here’s my code…
function my_custom_single_popular_post( $content, $p, $instance ){ $output = '<article class="post type-post status-publish format-standard has-post-thumbnail hentry">{thumb} <header> <h2 class="title entry-title"><a href="'.get_the_permalink($p->id).'" rel="bookmark" title="' . esc_attr($p->title) . '">' . esc_attr($p->title) . '</a></h2> </header> <div class="post-meta"><span class="author vcard"><span class="fn">author goes here</span></span> <span class="small">-</span> <abbr class="date time published updated" title="' . date( 'Y-m-d', strtotime($p->date) ) . '">' . date( 'Y-m-d', strtotime($p->date) ) . '</abbr> </div> <section class="entry"> <p>excerpt goes here</p> </section><!-- /.entry --> <div class="fix"></div> </article>'; } add_filter( 'wpp_post', 'my_custom_single_popular_post', 10, 3 );
If I remove the custom wpp_post filter in my functions.php file, it brings in the most popular post fine in list format. I’m trying to customize the format of each post.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Can't get wpp_post filter to work’ is closed to new replies.