Forums

Seperating Post Title and Page Title (4 posts)

  1. czone
    Member
    Posted 1 year ago #

    Hello Friends,
    I am new to WP and I am badly stuck with Post Title and Page Title.

    I made my own custom theme where I am displaying "Page Title" using some graphics.

    <div class="content" role="main">
    <div class="pagename"><h1 class="entry-title"><span><?php the_title(); ?></span></h1></div>
    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <h2 class="post-title"><span><?php the_title(); ?></span></h2>
    <div class="entry-content"> .........

    PROBLEM

    1. All the pages are displaying Title twice because the_title(); is also mentioned in Post.
    2. The Blog page "BLOG" when opened the page title is been replaced by the recent post title. I want the page title to display.

    I tried using wp_title in H1 it solves the problem but then the default static page displays nothing at Page Title. Please help me solve this problem, i worked really hard to built this theme.

  2. equalmark
    Member
    Posted 1 year ago #

    You need to put your titles inside the loop on the template. Therefore you need to replace:

    <h2 class="post-title"><span><?php the_title(); ?></span></h2>

    with whatever you want to use as your title - I guess something like this:

    <div class="pagename"><h1 class="entry-title"><span><?php the_title(); ?></span></h1></div>

  3. czone
    Member
    Posted 1 year ago #

    My posts are in a loop and that part is working fine i.e. whenever I add a new post it appears with its title.

    Here are 2 images to explain my problem

    Issue with Blog Page = http://www.mentorarts.com/images/blog.gif
    Issue with Pages = http://www.mentorarts.com/images/page.gif

  4. cruxwireweb
    Member
    Posted 1 year ago #

    Did you ever solve this one?

    The Blog page "BLOG" when opened the page title is been replaced by the recent post title. I want the page title to display.

    I'm having that problem too.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags