Support » Fixing WordPress » If the_title blank, how to…

  • Resolved skurudo

    (@skurudo)


    If the_title blank, how to display other name of post?

    For example:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    <?php the_title() ?> — how to change this to “if blank, then call this post mega-post#postid”?

    <?php endwhile; endif; ?>

Viewing 1 replies (of 1 total)
  • Thread Starter skurudo

    (@skurudo)

    Simple, all simple… heh.

    The code:

    <?php $title = get_the_title();
    if (strlen($title) == 0) echo ‘мега-супер-тема’; else echo $title; ?>

Viewing 1 replies (of 1 total)
  • The topic ‘If the_title blank, how to…’ is closed to new replies.