• Emphasis

    (@emphasis)


    First of all, I already checked the forum and most of them give a solution like

    “Post ID display none” or “Page title display none”.

    1) Don’t want all page titles to be deleted. I want the post titles to remain and the one on the Contact Page.
    2) Tried both (the /work page has ID 116 for example, I checked, but just no effect) https://www.niceflowertrading.com

    Thanks ahead!

Viewing 9 replies - 1 through 9 (of 9 total)
  • Chip Bennett

    (@chipbennett)

    Can you be a bit more clear on what you’re trying to accomplish?

    You want the Page Title not to appear on a known set of Pages?

    Thread Starter Emphasis

    (@emphasis)

    I want to keep the titles on my posts.

    But I want to remove the titles of certain pages, most important of all, the one on https://www.niceflowertrading66.com/work

    It would be even more awesome if the title was removed and not just hidden, cause else there will be huge whitespace between title and content.

    Chip Bennett

    (@chipbennett)

    There are a couple of ways to accomplish this:

    1) Create a custom page template file (e.g. “page-no-title.php”), that omits the Page Title, then assign this template to whichever Pages for which you don’t want to display the Title.

    or

    2) In your page.php template file, wrap a conditional around the call to the Page Title, so that it doesn’t display for the specified Pages, e.g. if you wanted to omit the Page Title for Pages with IDs 3, 5, and 10:

    <?php
    $pages_to_omit_title = array( '3', '5', '10' ); // enter Page IDs, comma-separated
    global $page;
    $display_title = ( array_key_exists( $page->ID, $pages_to_omit_title ) ? false : true );
    
    if ( $display_title ) { ?>
         <h1><?php the_title(); ?></h1>
    <?php }
    ?>

    Note: untested

    (As you can see, the first option is probably the easier route.)

    Thread Starter Emphasis

    (@emphasis)

    1) Had no succes with custom page, that is with the making of the template itself. Made a new .php file in my themes directory with all the normal code and left out the header stuff. But when I tried to make a page and assign the template, there were none to select.

    2) Wrapping around didnt work, but very likely that I didn’t wrap it right.
    When I wrapped it like this:

    <?php
    $pages_to_omit_title = array( '200', '116', '2', '11' ); // enter Page IDs, comma-separated
    global $page;
    $display_title = ( array_key_exists( $page->ID, $pages_to_omit_title ) ? false : true );
    
    if ( $display_title ) { ?>
         <h2><?php the_title(); ?></h2>
    
    			<h2 class="entrytitle"><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    
    <?php }
    ?>

    The post title appeared a second time

    When I wrapped it like this:

    <?php
    $pages_to_omit_title = array( '200', '116', '2', '11' ); // enter Page IDs, comma-separated
    global $page;
    $display_title = ( array_key_exists( $page->ID, $pages_to_omit_title ) ? false : true );
    
    			<h2 class="entrytitle"><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    
    if ( $display_title ) { ?>
         <h2><?php the_title(); ?></h2>
    
    <?php }
    ?>

    I got an error: Parse error: syntax error, unexpected '<' in /usr/www/users/nicefl/wp-content/themes/karappo-style/index.php on line 18

    I want the dates gone on all the pages (except posts again) as well now. Sorry for the hastle :/

    Alwyn Botha

    (@123milliseconds)

    Please paste page.php at https://wordpress.pastebin.com/

    Select PHP syntax highlighting so we can easily read the code

    Thread Starter Emphasis

    (@emphasis)

    Ok so first attempt looked like this:

    and gave me the title a second time

    Second attempt which gave me the syntax error had this wrapping:

    Alwyn Botha

    (@123milliseconds)

    1st attempt

    you have 2 titles; thats why

    remove line 7

    <h2><?php the_title(); ?></h2>

    Thread Starter Emphasis

    (@emphasis)

    Yeah if I remove that one, the second title is gone indeed. But my title is still there, which I wanted to get rid of to start with ??

    Thread Starter Emphasis

    (@emphasis)

    Ok nothing is working. Right now I’d be happy if it just displayed on the blogposts (https://www.niceflowertrading66.com/blog). No titles on the other pages.

    Can someone please help me out ??

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Remove title on selected pages.’ is closed to new replies.