Info
- 4 posts
- 2 voices
- Started 2 years ago by PS Vita
- Latest reply from PS Vita
- This topic is resolved
Put PHP together
-
- Posted 2 years ago #
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" ); } ?> -
- Posted 2 years ago #
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.
-
- Posted 2 years ago #
It worked, thank you mod!
-
- Posted 2 years ago #
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/3This is really good for your SEO and will avoid duplicated topic titles.
-
You must log in to post.