Category index page
Summary
You have to create a new page with the title "Features" (slug "features").
I have done this for the six categories and they can be seen as in this example
https://spainonthisday.com/history
However I've been unable to populate them with the pages
so, with the 'slugs' created you wrote
But you can also use one template with $categoryKey = $page->slug().
Can you now please explain is that line a single template - or where do I place it and how is it triggered
and then I suppose I have to edit the pages concerned to select the template in advanced options but currently they don't appear to be selected
Hopefully I'll be able to solve it soon
Many thanks
You have to create a new page with the title "Features" (slug "features").
I have done this for the six categories and they can be seen as in this example
https://spainonthisday.com/history
However I've been unable to populate them with the pages
so, with the 'slugs' created you wrote
But you can also use one template with $categoryKey = $page->slug().
Can you now please explain is that line a single template - or where do I place it and how is it triggered
and then I suppose I have to edit the pages concerned to select the template in advanced options but currently they don't appear to be selected
Hopefully I'll be able to solve it soon
Many thanks
- Edi
- Site Admin
- Posts: 3121
- Joined: Sun Aug 09, 2015 5:01 pm
- Location: Zurich
- Has thanked: 54 times
- Been thanked: 77 times
- Contact:
Step by step...
1) Modification index.php
Modify the template index.php of the theme Andy.
Use the following (line 63):
instead of
1) Modification index.php
Modify the template index.php of the theme Andy.
Use the following (line 63):
Code: Select all
<?php
if ($WHERE_AM_I == 'page') {
if ($page->slug() == "features" {
include(THEME_DIR_PHP.'category.php');
} else {
include(THEME_DIR_PHP.'page.php');
}
} else {
include(THEME_DIR_PHP.'home.php');
}
?>
Code: Select all
<?php
// Bludit content are pages
// But if you order the content by date
// These pages works as posts
// $WHERE_AM_I variable detect where the user is browsing
// If the user is watching a particular page/post the variable takes the value "page"
// If the user is watching the frontpage the variable takes the value "home"
if ($WHERE_AM_I == 'page') {
include(THEME_DIR_PHP . 'page.php');
} else {
include(THEME_DIR_PHP . 'home.php');
}
?>
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
Many thanks
Unfortunately exchanging the code stopped the front page from loading
the category php files i have placed in bi-themes/andy/php/
are
sightseeing.php
recipes.php
profiles.php
letters_from_spain.php
history.php
features.php
also there are
page.php
home.php
sidebar.php
navbar.php
footer.php
$categoryKey = $page->slug().is not being used as far as I can see
Unfortunately exchanging the code stopped the front page from loading
the category php files i have placed in bi-themes/andy/php/
are
sightseeing.php
recipes.php
profiles.php
letters_from_spain.php
history.php
features.php
also there are
page.php
home.php
sidebar.php
navbar.php
footer.php
$categoryKey = $page->slug().is not being used as far as I can see
- Edi
- Site Admin
- Posts: 3121
- Joined: Sun Aug 09, 2015 5:01 pm
- Location: Zurich
- Has thanked: 54 times
- Been thanked: 77 times
- Contact:
Sorry, there was an error in the code.
It has to be
Code: Select all
if ($page->slug() == "features") {
Code: Select all
if ($page->slug() == "features" {
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
Solved
I made the index pages by hand and saw that I needed to use /category/ for the next page to appear at the bottom
I've also found a simple set of jscript to give a random image at the top of the page
https://spainonthisday.com/history
<center><script type="text/javascript">
//Javascript Created by Computerhope https://www.computerhope.com/
//store the quotations in arrays
var images = [],
index = 0;
images[0] = "<img src='/images/gallery1.jpg'</a>";
images[1] = "<img src='/images/gallery2.jpg'</a>";
images[2] = "<img src='/images/gallery3.jpg'</a>";
images[3] = "<img src='/images/gallery4.jpg'</a>";
images[4] = "<img src='/images/gallery5.jpg'</a>";
images[5] = "<img src='/images/gallery6.jpg'</a>";
images[6] = "<img src='/images/gallery7.jpg'</a>";
images[7] = "<img src='/images/gallery8.jpg'</a>";
index = Math.floor(Math.random() * images.length);
document.write(images[index]);
//done
</script></center>
I made the index pages by hand and saw that I needed to use /category/ for the next page to appear at the bottom
I've also found a simple set of jscript to give a random image at the top of the page
https://spainonthisday.com/history
<center><script type="text/javascript">
//Javascript Created by Computerhope https://www.computerhope.com/
//store the quotations in arrays
var images = [],
index = 0;
images[0] = "<img src='/images/gallery1.jpg'</a>";
images[1] = "<img src='/images/gallery2.jpg'</a>";
images[2] = "<img src='/images/gallery3.jpg'</a>";
images[3] = "<img src='/images/gallery4.jpg'</a>";
images[4] = "<img src='/images/gallery5.jpg'</a>";
images[5] = "<img src='/images/gallery6.jpg'</a>";
images[6] = "<img src='/images/gallery7.jpg'</a>";
images[7] = "<img src='/images/gallery8.jpg'</a>";
index = Math.floor(Math.random() * images.length);
document.write(images[index]);
//done
</script></center>