• Hello, I have a problem that I hope you can help me to solve.

    For web design reasons, I need to insert the title of my pages and posts using the php function “the_title”.
    On the title thus generated I then apply the css style.

    All this happens regularly in the pages.

    But there is a problem with the posts.
    Indeed wordpress automatically adds a title “H1” in the posts, corresponding to the title of the post.

    This is not the case for page titles.

    This circumstance determines that two titles are loaded in my posts: the first through the php function “the_title”; the second automatically from wordpress.

    I specify that I can’t solve by simply applying a “display: none”, via css, to the H1 element created by wordpress, because this would be applied to all the H1 elements present on the web site.

    How can I solve this problem?
    Is it possible to make the title of the posts in wordpress behave like the title of the pages?

    Thanks for the the help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The output in the frontend is not done by WordPress alone but by the theme you use. Which one do you use? And how do you use the_title specifically? Do you create a child theme with your own templates?

    Thread Starter ivanisevic82

    (@ivanisevic82)

    Hi, I fixed it!

    Actually the “h1” tag containing the title was not formed automatically in each post by WordPress, but it was part of my code present in single.php

    I just deleted it and fixed the problem.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Different behavior of the title in pages and posts’ is closed to new replies.