• Hi,
    I have tried search and a lot of codes, but Im not able to remove H1 / title / Underscore – for specific pages. I dont want use CSS. I would like to remove it via functions.php or in content.php.
    Im not good in PHP, so codex didnt help me too much 🙁

    I need something like this:
    if > page slugs / IDs > do not display H1/ title

    Can anybody help? Thanks you

Viewing 6 replies - 1 through 6 (of 6 total)
  • Can you post a link and point out what you’re trying to hide? And telling us which theme your using would help.

    Thread Starter gore.m

    (@gorem)

    Im on localhost. Theme I use is “Underscore” _S, starter theme.

    Im trying to remove this (code from html):

    <header class="entry-header">
    		<h1 class="entry-title">Index</h1>	</header><!-- .entry-header -->

    for specific pages.

    Comes from content-page.php template:

    <header class="entry-header">
    		<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
    	</header><!-- .entry-header -->
    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    You can use the is_page function to determine whether to display the title

    https://developer.wordpress.org/reference/functions/is_page/

    or create an array of post ids you want to exclude, then get the current post ID and if the ID is in that array, skip over outputting the title.

    There’s a bunch of ways and lots of conditional functions you can use for your test:

    https://codex.wordpress.org/Conditional_Tags

    Thread Starter gore.m

    (@gorem)

    Thanks you Steve. That is where Im ending…

    if ( is_page(array('xxxx', 'xxxx') )) { ....

    but I dont know how continue. As I wrote: Im not good in PHP, so WP codex didnt help me too much 🙁 Can you help me to finish it?
    thanks you

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    I’m not good in PHP

    Given that, I question your choice to build a theme from _s, as it’s a developer’s theme.

    The model for your code should be something like

    if ( it's not in this array ) {
      do the code to print the title
      } else {
      probably do nothing
      }
    Thread Starter gore.m

    (@gorem)

    I have everything done, only title is problem, i need solve.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Remove H1 / title / Underscore – without CSS’ is closed to new replies.