• Resolved Philip John

    (@ppeter)


    Hi.
    I’m very new to WordPress and I’m not good with the function etc. Now, I have used the_excerpt() instead of the_content() which has obviously put the excerpt everywhere. The solution I’ve found by searching around is to either add a single.php file or use a conditional in index.php to choose to display the excerpt on the permalink page.

    I get the single.php option, which I’d rather not do, but I haven’t a clue on using the conditional and couldn’t find out how to do that – any ideas?

    Many thanks in advance, Phil

Viewing 3 replies - 1 through 3 (of 3 total)
  • TechGnome

    (@techgnome)

    In a word: The Codex (ok, so it was two).
    https://codex.www.ads-software.com/Conditional_Tags

    -tg

    Thread Starter Philip John

    (@ppeter)

    EDIT: Thanks TG!

    Okay I figured it out. For anyone else wanting to know this the solution is as follows…
    You simply replace the_excerpt() with this conditional:

    if (is_single()){
    the_content();

    } else {
    the_excerpt();
    }

    is_single() returns TRUE when you are viewing a single post, so you can then show the full text but show the excerpt on all other pages.

    Phil

    TechGnome

    (@techgnome)

    To make it easier for those that follow, could you please mark the thread as Resolved? There’s a link to click on at the top that will do that.

    Thanks.
    Tg

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Using a conditional instead of separate single.php page’ is closed to new replies.