Forums

Join
bbPress Support ForumsTroubleshootingPut PHP together

Info

Tags

Put PHP together

  1. 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" ); } ?>

  2. 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.

  3. It worked, thank you mod!

  4. 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.

  5. You must log in to post.