ThemeShaper Forums » Thematic

[closed]

Displaying the Page title for the actual Blog

(2 posts)
  • Started 4 years ago by napalm
  • Latest reply from Jamie Mitchell
  • This topic is not resolved
  1. Hi All,
    I've seem to run into a problem.

    My plan was to move move the title of the page into the header. So i created a custom field for each page (with the name i want to display) and then put this in the header <?php echo get_post_meta($post->ID, 'page-title', true) ?>.

    The has worked perfect for all the pages except for the 'News' page , which I'm using as the actual blog. At the moment nothing displays in the header for the 'News' page or when you click on the post.

    Is there a way that I can say that , if a visitor is on the news page or reading a post from the news blog, to display 'News" ?

    Is that possible ?
    Thanks in advance.

    Posted 4 years ago #
  2. Jamie Mitchell
    Member

    this is what i do (goes in your childtheme functions)

    it removes then moves the page title to a new location below the header, and the blog page gets called news

    this is from a project, so i'm sure you can modify it to suit, like move to above header, in the header or wherever....

    no need to use custom fields.

    //Remove out title
    function remove_title($posttitle) {
        if (is_page()) {
            return '';
        } elseif (is_404()) {
            return '';
        } else {
        		return $posttitle;
        }
    }
    add_filter('thematic_postheader_posttitle', 'remove_title');
    
    //and add it back in how we want
    function move_title() {
        global $id, $post, $authordata;
        if (is_page()) {
            echo ('<div id="leader"><div id="leader-container"><h1>' . get_the_title() . "</h1></div></div>\n");
        } elseif (is_404()) {
            echo ('<div id="leader"><div id="leader-container"><h1>' . __('Not Found', 'thematic') . "</h1></div></div>\n");
        } elseif (is_home() || is_single()) {
            echo ('<div id="leader"><div id="leader-container"><h1>News</h1></div></div>');
        }
    }
    add_action('thematic_belowheader', 'move_title');

    styled something like this as a guide.

    #leader{
        padding:10px 0;
    }
    
    #leader-container {
        margin:0 auto;
        overflow:hidden;
        position:relative;
        width:960px;
    }
    
    #leader-container h1 {
        /*do what you want here*/
    }

    J

    Posted 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.