Support » Themes and Templates » Removing title from a single page or post using Custom Fields

  • Resolved zerpex

    (@zerpex)


    Hello, Lots of questions from me..

    Anyway – Is there any way to remove a page or post title using custom fields? – Instead of manually add it to the CSS, or don’t give the page or post any name?

    Best regards,
    Lucas

Viewing 4 replies - 1 through 4 (of 4 total)
  • esmi

    (@esmi)

    Forum Moderator

    <?php if ( !get_post_meta($post->ID, 'no_title', true) ) : ?>
    <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s'), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    <?php endif; ?>

    Thank you Esmi

    adi339

    (@adi339)

    I have the same question but do not understand the answer. Do I have to edit the code to put that code in, or is that used in the custom fields area (which I read about and still don’t understand)?

    thanks

    adl339 –

    The code above shows how to check whether a ‘no_title’ custom field has been set, and if it has, then don’t show the title. If it has not, then show the title.

    IF you are looking to not show ANY titles EVER – then it is easier to just edit your theme’s template.

    Otherwise – start diving into custom meta.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Removing title from a single page or post using Custom Fields’ is closed to new replies.