WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] if - is not [template] show title. how? PHP string? (3 posts)

  1. gcoulby
    Member
    Posted 1 year ago #

    This is what I have so far and it's not working.

    `<?php

    $get_title = the_title();

    if ( ! is_page_template( 'page-templates/product-page.php' ) ) {
    echo <h1 class="entry-title"> . $get_title . </h1>
    }
    ?>`
    I want it to NOT display the title on that, template.

  2. Andrew
    Forum Moderator
    Posted 1 year ago #

    You're not wrapping the echo's HTML output in quotes or apostrophes.
    See http://php.net/manual/en/function.echo.php

    In future, please describe the issue more thoroughly other than, "not working".

  3. gcoulby
    Member
    Posted 1 year ago #

    My apologies it was just the php syntax got me again.

    <?php
               if ( ! is_page_template( 'page-templates/product-page.php' ) ) {
             ?>
    
    		<h1 class="entry-title"><?php the_title(); ?></h1>
    
    	  <?php
    	  }
    	  ?>

    here was what I was wanting.

Topic Closed

This topic has been closed to new replies.

About this Topic