WordPress.org

Ready to get started?Download WordPress

Forums

Remove post title (15 posts)

  1. Odenberg
    Member
    Posted 3 years ago #

    Hi!

    Im trying to remove my post title and add a fake title in the post (between the image and the text).

    But I cant make it work. First I added display: none to 'post h2', but since I want my "fake title" in the post to be h2, it doesnt work. Then I tried to remove the post title by puting display:none to 'post a'. It did remove post titles, but also post images and my link within thumbnails, so that didnt work either.

    Anyone knows how to do this? I would be very grateful for some help, since Im really stuck.

    Her is my site.

  2. iteamweb
    Member
    Posted 3 years ago #

    Please try to write the same code for
    .entry-title this class , so it may help. this will be in loop.php

  3. Odenberg
    Member
    Posted 3 years ago #

    Sorry, I dont understand. Were in the loop should I write entry-title?

    Here is the loop in my index.php:

    <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>

    <div class="post" id="post-<?php the_ID(); ?>">

    " title="<?php the_title(); ?>"><?php the_title(); ?>

    <?php } ?>

    <div class="entry">

    <?php the_content(); ?>

    </div>

    </div>

    <?php endwhile; ?>

    <div class="navigation">

    <?php posts_nav_link(); ?>

    </div>

    <?php else : ?>

    <div class="post">

    <h4><?php _e('Not Found'); ?></h4>

    </div>

    <?php endif; ?>

    </div>

    Very thankful for help

  4. shawnyuan
    Member
    Posted 3 years ago #

    Where in the code do you want to add the fake title? And what do you mean by fake title?

  5. jakep_sf
    Member
    Posted 3 years ago #

    Alternatively you could use a theme that supports nav_menu
    http://codex.wordpress.org/Function_Reference/register_nav_menu
    You can then create your pages and name them whatever you wish to display on the page and in the navigation label title it what you wish it to display in the navigation.

  6. Odenberg
    Member
    Posted 3 years ago #

    I want the post to start with an image. Right below the the image, I want a headline. For SEO reasons, I want this headline to be <h2>, and I need the post title (that is usually above the post entry) to be <h3> and not show (other than in the sidebar). Under the <h2>headline (fake headline), I want the text.

    So, any one has a solution to this? I really appritiate it.

  7. Odenberg
    Member
    Posted 3 years ago #

    jakep_sf:

    Sorry, I dont get it. And I also dont want to change my theme.

  8. shawnyuan
    Member
    Posted 3 years ago #

    Just do that in the visual editor.

    Put the image, then put the title you want and then put the text.

  9. Odenberg
    Member
    Posted 3 years ago #

    But the problem is that it wont work.

    If you look at my site, you can that there is a title above the image and one below. I want to get rid of the one above the image.

    To to that I thaught I put <h3>tags around the post title in the loop, like this:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
    <div class="post" id="post-<?php the_ID(); ?>">
    <h3>" title="<?php the_title(); ?>"><?php the_title(); ?></h3>
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    In my CSS i have put:

    .post h2{font-family: Arial, Helvetica, san-serif;
    font-size: 12px;
    letter-spacing:0.1em;
    color:black;
    text-transform:uppercase;
    }

    .post h3{display:none;}

    And then I have put <h2>tags around the headline in the post editor.

    The wired thing is that the <h3>tag dont work. When I look at my source file, the post title part in the loop is surrounded by <h2>tags instead of the <h3> tags in my index file.

    Anyone knows why this happens? Why is the <h3>tags in my index file replaced by <h2>tags?

  10. Manuel Schmalstieg
    Member
    Posted 3 years ago #

    If i understand what you intend to do, the smartest thing might be to use a Custom Field (which you add to the post, below the editor interface). Let's say you name it "FakeTitle".

    In your theme, you would modify the single.php file rather than index.php (or perhaps both, depending if the fake title should appear on your front page as well).

    In your loop you would replace the <?php the_title(); ?> stuff with something like that:

    <?php
    $fake_title = get_post_meta($post->ID, 'FakeTitle', true);
    //get the FakeTitle field, if it exists
    if($fake_title !== '') { //if it exists
    echo $fake_title; //display the fake title
    } else {
    the_title(); //display the post title
    } ?>
  11. Manuel Schmalstieg
    Member
    Posted 3 years ago #

    ...or you could remove the line echo $fake_title;from the code above ... which would mean that IF you define a FakeTitle, no post title gets displayed. And you would then add it manually inside your post.

  12. Odenberg
    Member
    Posted 3 years ago #

    Thanks a lot everyone for your suggestions and for trying to help me!

    The solution was really simple; I made the changes with the <h3>tag in both the index ande the single files (like tar.gz suggested).

    And now it works! The post title is gone and the headline in the post is <h2>.

    Thanks a lot everyone!

  13. Odenberg
    Member
    Posted 3 years ago #

    Hm...

    Undfortunately, I was a littel fast to say it worked. It ony works partly. When just one post is showing, like this, it looks fine. But when the categories are shown, the post title also is showing, and surronded wiht <h2>tags instead of the <h3>tags that is stated in the theme.

    Can anyone figure out why the title is changed to <h2>?

  14. Manuel Schmalstieg
    Member
    Posted 3 years ago #

    When the categories are shown, WordPress will use either category.php or, if that file doesn't exist, archive.php - so you need to customize those as well.

    At that point, you should have a look at the WordPress template hierarchy to get a better understanding of your theme.

    When I started customizing themes, I found this article a very useful starting point.

  15. Odenberg
    Member
    Posted 3 years ago #

    Oh. Im stupid.

    Now that I created category and archive files and placed <h3>tags there it works perfect.

    And thank you for the link, It was very helpful.

    Have a nice weekend!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.