Forums

[resolved] Removing title from a single page or post using Custom Fields (5 posts)

  1. zerpex
    Member
    Posted 10 months ago #

    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

  2. esmi
    Theme Diva & Forum Moderator
    Posted 10 months ago #

    <?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; ?>
  3. zerpex
    Member
    Posted 10 months ago #

    Thank you Esmi

  4. adi339
    Member
    Posted 10 months ago #

    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

  5. Driftless1
    Member
    Posted 8 months ago #

    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.

Reply

You must log in to post.

About this Topic