• Hello,

    I’m not sure if this is the correct section for this post, so I apologize up front for any mistake. I’m trying to attempt to remove page titles from certain pages, as they’re not needed although I do want to keep them on others.

    I tried the code below, I’m no coder but I thought it would be fairly easy to modify the line of code which removes it from the home page. I’m mistaken though.

    Any help would be greatly appreciated.

    <?php if (! is_page('page-title') ) ?>
    						<h2 class="entry-title"><?php the_title(); ?></h2>
Viewing 15 replies - 1 through 15 (of 15 total)
  • Your code is correct (assuming that you replace page-title with the actual title of a Page) but you may be adding it to the wrong template file. Have you tried adding it to page.php?

    Thread Starter joey_matthews

    (@joey_matthews)

    Hello Esmi

    Yes, I tried adding the code below the line for hiding the page title on the home page. (on page.php)`

    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    					<?php if ( is_front_page() ) { ?>
    						<h2 class="entry-title"><?php the_title(); ?></h2>
                                            <?php if (! is_page('forum') ) ?>
    						<h2 class="entry-title"><?php the_title(); ?></h2>
    					<?php } else { ?>
    						<h1 class="entry-title"><?php the_title(); ?></h1>
    					<?php } ?>

    Here’s the code.. Have I inserted it wrongly? Thanks

    You had a few syntax errors in there. Try:

    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <?php if ( is_front_page() ) { ?> <h2 class="entry-title"><?php the_title(); ?></h2>
    <?php elseif (! is_page('forum') ) ?><h2 class="entry-title"><?php the_title(); ?></h2>
    <?php else ?><h1 class="entry-title"><?php the_title(); ?></h1>

    However, I’m a little confused by the logic. On every page except the Forum & Home pages, both the 2nd and 3rd lines will be true.

    Thread Starter joey_matthews

    (@joey_matthews)

    That appears to make every page except my home one go blank.

    There was an unwanted bracket still in there:

    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <?php if ( is_front_page() )  ?> <h2 class="entry-title"><?php the_title(); ?></h2>
    <?php elseif (! is_page('forum') ) ?><h2 class="entry-title"><?php the_title(); ?></h2>
    <?php else ?><h1 class="entry-title"><?php the_title(); ?></h1>
    Thread Starter joey_matthews

    (@joey_matthews)

    No difference esmi.

    Replaced the code but I still receive a Blank page. :/

    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <?php if ( is_front_page() ){  ?> <h2 class="entry-title"><?php the_title(); ?></h2>
    <?php }elseif ( !is_page('forum') ){ ?><h2 class="entry-title"><?php the_title(); ?></h2>
    <?php }else{ ?><h1 class="entry-title"><?php the_title(); ?></h1><?php } ?>
    Thread Starter joey_matthews

    (@joey_matthews)

    It’s now displaying pages fine, although I still see the page title within the forum section. Appreciate the help from you both on this, it seems to be awkward thing to deal with.

    I didn’t get the logic of you code either, I just fixed some syntax errors.

    Maybe you are trying for this

    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <?php if ( is_front_page() ){  ?> <h2 class="entry-title"><?php the_title(); ?></h2>
    <?php }elseif ( !is_page('forum') ){ ?>
    <?php }else{ ?><h1 class="entry-title"><?php the_title(); ?></h1><?php } ?>

    Thread Starter joey_matthews

    (@joey_matthews)

    I have a plugin which integrates a forum solution inside mybb and I’ve managed to remove the sidebar from showing on the forum page but I haven’t been able to remove the page title from it.

    Reuben; The code you’ve given me as removed the page title from the “about” page, while I was trying to remove the sidebar I experienced a similar issue after noticing it had been removed from the home page. I managed to resolve this by following another article which told me to try the page.php template. Could it be possible that I have the wrong template?

    I don’t know why it would remove it from the about page, when ‘forum’ is coded in the lines.

    It will remove from the about page and also other pages because the ‘forum’ page does not exist. You need the exact name/slug/id of the forum page.

    Thread Starter joey_matthews

    (@joey_matthews)

    Update…

    I don’t understand why this as worked but I replaced “forums” with “about” just to see what it would do and for some reason it’s done the opposite. I now have about showing and the forums title not just unsure why this is the case.

    https://www.talkfear.com/forum/

    Is there anyway of moving the forum display up more? (reduce the white space)

    Thanks again for the help, I wouldn’t of got this far without the kindness of you both. Moving along slowly, progress ??

    oh forgot there is ‘!’ symbol in elseif, remove that ! and replace about with forum, so it works properly..

    Thread Starter joey_matthews

    (@joey_matthews)

    Perfect. Thank you once again Reuben ??

    Thread Starter joey_matthews

    (@joey_matthews)

    I’ve actually noticed that things have gone wrong slightly within the forum and about me page.

    Something appears to of broken the theme slightly. :/

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Removing page title from certain page(s)’ is closed to new replies.