Skip to:
Content
Pages
Categories
Search
Top
Bottom

Put PHP together


  • Alifar
    Blocked

    @56alifar

    Hi there,

    Does anyone know how i can put the below 3 PHP lines together wrapped in 1 line with less tags?

    <?php if (is_front() && $page>1) {echo(” page $page” ); } ?>

    <?php if (is_topic() && $page>1) {echo(” page $page” ); } ?>

    <?php if (is_forum() && $page>1) {echo(” page $page” ); } ?>

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

  • chrishajer
    Participant

    @chrishajer

    Do you want to echo the $page if ANY of them are true? So, an OR statement?

    <?php if ($page>1 && (is_front() || is_topic() || is_forum())) echo " page $page"; ?>

    That should do it, unless I misunderstood your problem.


    Alifar
    Blocked

    @56alifar

    It worked, thank you mod!


    Alifar
    Blocked

    @56alifar

    For everybody’s information, this puts pagination in the title thats good for SEO.

    For example:

    If you change the following:

    <title><?php bb_title() ?></title>

    To:

    <title><?php bb_title() ?><?php if ($page>1 && (is_front() || is_topic() || is_forum())) echo ” – page $page”; ?></title>

    in your header.php file of your theme folder.

    Now every page has a unique title because the pagination has added in the title.

    Example:

    http://www.jahw.nl/forums/page/4

    http://www.jahw.nl/forums/topic/favoriete-alcoholisch-drankje/page/3

    This is really good for your SEO and will avoid duplicated topic titles.

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

You must be logged in to reply to this topic.