ThemeShaper Forums » Thematic


Using views after comments vith plugin

(4 posts)
  • Started 11 years ago by soren
  • Latest reply from helgatheviking
  • This topic is not resolved


  1. Hello!

    My problem is that I am trying to use the "wp-postviews" plugin and put the result after the comments-link above the post-title.

    The instructions for the plugin says:

    = Usage =
    1. Open wp-content/themes/<YOUR THEME NAME>/index.php
    2. You may place it in archive.php, single.php, post.php or page.php also.
    3. Find: <?php while (have_posts()) : the_post(); ?>
    4. Add Anywhere Below It (The Place You Want The Views To Show): <?php if(function_exists('the_views')) { the_views(); } ?>

    I try to put this in the function.php in thematic childtheme but I have problems to style it and it gets stucked to the left corner and push the entrydate and postcomments to the right. I want to be on the right side with some padding or margin for equal distance

    The code is below, I try to put the plugin code inside where I wanted it to be, but I does not work for me...

    Any advices for make it work or a better way doing it?

    You can see my problem at


    // ********** START move Post meta above title START **********
    function meta_split_title($thepostheader) {
    global $post;
    if(is_page() || is_404()){
    $thepostheader = thematic_postheader_posttitle();
    } else {
    $thepostheader = thematic_postmeta_entrydate() .thematic_postfooter_postcomments(); the_views();
    //comment out... if(function_exists('the_views')) { the_views();} ...comment out//
    $thepostheader .= thematic_postheader_posttitle() . thematic_postmeta_authorlink();
    return $thepostheader;
    add_filter('thematic_postheader', 'meta_split_title');
    Posted 11 years ago #
  2. the_views() probably echos instead of returns. is there an equivalent get_the_views() that will return the value?

    otherwise your filter looks correct

    Posted 11 years ago #
  3. Looks like it echos as you said, could not find "get_the_views" only this part of the php file!

    With the setting right now it drops into the div#content and I can not do much with it from there...

    ### Function: Display The Post Views
    function the_views($display = true, $prefix = '', $postfix = '', $always = false) {
    	$post_views = intval(post_custom('views'));
    	$views_options = get_option('views_options');
    	if ($always || should_views_be_displayed($views_options)) {
    		$output = $prefix.str_replace('%VIEW_COUNT%', number_format_i18n($post_views), $views_options['template']).$postfix;
    		if($display) {
    			echo apply_filters('the_views', $output);
    		} else {
    			return apply_filters('the_views', $output);
    	elseif (!$display) {
    		return '';
    Posted 11 years ago #
  4. instead of filtering you could try the override

    function childtheme_override_postheader(){
      echo 'bacon';
    Posted 11 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.