ThemeShaper Forums » Thematic

[closed]

No post meta on pages?

(7 posts)
  • Started 7 years ago by chris_s
  • Latest reply from chris_s
  • This topic is resolved

Tags:

  1. Is there not supposed to be any post meta on a page? I'm currently using Thematic rev756. I am trying to output the author, but am not sure how to do it the best way.

    This is currently the code I'm using but it replaces my entire title.

    EDIT: used thematic_postheader_postmeta instead of thematic_postheader and nothing shows up.

    function add_author() {
    	if (is_page()) {
    		echo '<p class="author">By:' . the_author();
    		echo '</p>';
    	}
    }
    add_action('thematic_postheader_postmeta','add_author');
    Posted 7 years ago #
  2. sowingseeds
    Member

    In content-extensions.php (inside extensions folder) you will see various code. Search for postmeta, and you will discover a childtheme override. Try adding to your childtheme functions file:

    function childtheme_override_postheader(){
    global $post;
    	   if ( is_404()){
     	       $postheader = thematic_postheader_posttitle();
     	   } else {
     	       $postheader = thematic_postheader_posttitle() . thematic_postheader_postmeta();
     	   }
    echo apply_filters( 'thematic_postheader', $postheader );
    }

    That should give you the same postmeta on your pages as on your posts.

    Posted 7 years ago #
  3. works perfectly. and that's what I was trying to do, but couldn't figure it out exactly. My next question would be, how do I filter the postmeta to output only the author?

    Posted 7 years ago #
  4. function childtheme_override_postheader_postmeta() {
    	global $post;
    		if ( $post->post_type == 'page') {
    		$postmeta = '<div class="entry-meta">';
    		$postmeta .= thematic_postmeta_authorlink();
    		$postmeta .= "</div><!-- .entry-meta -->\n";
    		} else {
    		$postmeta = '<div class="entry-meta">';
    		$postmeta .= thematic_postmeta_authorlink();
    		$postmeta .= '<span class="meta-sep meta-sep-entry-date"> | </span>';
    		$postmeta .= thematic_postmeta_entrydate();
    		$postmeta .= thematic_postmeta_editlink();
    		$postmeta .= "</div><!-- .entry-meta -->\n";
    		}
    	return apply_filters('thematic_postheader_postmeta',$postmeta);
    }

    All of this information is in the thematic/library/extensions/content-extensions.php, I don't exactly know if this is the most efficient way of doing it (I don't know PHP), but it will get it done.

    Posted 7 years ago #
  5. EDIT: @Sowingseeds, your code does not show the postmeta in the posts. Tried a variety of different approaches to get it to work but nada. Any help?

    ScottNix. Worked perfect. I just left out the else statement since all I wanted anywhere in the site was the Author name. I also switched out thematic_postmeta_authorlink() with get_the_author() which outputs just the author name with no link to their archive.

    Thanks for the help guys!

    Posted 7 years ago #
  6. Tested sowingseeds code snippet, in fact I compared it to the one I was working on before he beat me to the response, they are identical, so it should be working.

    Posted 7 years ago #
  7. This is what ended up working for me.

    function childtheme_override_postheader(){
    global $post;
    	   if ( is_404()){
     	       $postheader = thematic_postheader_posttitle();
     	   } elseif ( $post->post_type == 'page' || $post->post_type == 'post')  {
     	       $postheader = thematic_postheader_posttitle();
     	       $postheader .= '<div class="entry-meta">By: ';
     	       $postheader .= '<span class="author-meta">';
     	       $postheader .= get_the_author();
     	       $postheader .= "</span></div><!-- .entry-meta -->\n";
    
     	   }
    echo apply_filters( 'thematic_postheader', $postheader );
    }
    Posted 7 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.