ThemeShaper Forums » Thematic

[closed]

Move the Post Date Above the Post Title

(4 posts)
  • Started 10 years ago by Devin
  • Latest reply from perryb
  • This topic is not a support question
  1. For a project I needed to move the post date above the post title. These forums are generally the first stop I go to for information like this, and I didn't see a solution posted, so here's how I did it:

    // Move the date of the post above the title
    
    function childtheme_postheader($postheader) {
    
        global $post;
    
        if ($post->post_type == 'page' || is_404()) {
            $postheader = thematic_postheader_posttitle();
        } else {
            $postheader = '<div class="postdate"><span>' . get_the_time(thematic_time_display()) . '</span></div>' . thematic_postheader_posttitle() . thematic_postheader_postmeta();
        }
    
    	return $postheader;
    }
    
    add_filter('thematic_postheader', 'childtheme_postheader');
    
    /* Custom Post Meta */
    
    function childtheme_postheader_postmeta($postmeta) {
    	$postmeta = '';
        $postmeta = '<div class="entry-meta">';
        $postmeta .= thematic_postmeta_authorlink();
        $postmeta .= thematic_postmeta_editlink();
        $postmeta .= "</div><!-- .entry-meta -->\n";
    
        return $postmeta; 
    
    }
    
    add_filter('thematic_postheader_postmeta', 'childtheme_postheader_postmeta');
    Posted 10 years ago #
  2. Thanks Devin! I probably would (and have) re-written the entire post-header. I really need to get a handle on better filtering.

    Posted 10 years ago #
  3. Hi - I've been trying to modify the above code so that a line of text will only appear beneath the title where the post is tagged x + y. As in:

    if ($post->post_type == 'page' && ***tags here***) etc.

    But I can't seem to find any reference as to how I can do this.

    has_tags('x','y') for example doesn't seem to do the trick. The Codex says that this tag must be used inside the Loop - which it should do if placed inside postheader right?

    Does anyone know what the magic bullet is?

    Posted 10 years ago #
  4. I managed to work it out.

    In my example I wanted to add some text to posts with either one of two tags 'Video' and 'object-video'.

    The code is only superficially different to Devin's example above, but with has_tag which in this case uses an array:

    `function childtheme_postheader($postheader) {

    global $post;

    if ($post->post_type == has_tag(array('Video','object-video'))) {
    $postheader = thematic_postheader_posttitle() . 'Click on the image below to view the video';
    } else {
    $postheader = thematic_postheader_posttitle();
    }

    return $postheader;
    }

    add_filter('thematic_postheader', 'childtheme_postheader');'

    Posted 10 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.