This code lists all tags:
Code: Select all
<?php
// Returns an array with all the tags
$items = getTags();
foreach ($items as $tag) {
echo 'Tag name: ' . $tag->name();
}
?>
Code: Select all
<?php
// Returns an array with all the tags
$items = getTags();
foreach ($items as $tag) {
echo 'Tag name: ' . $tag->name();
}
?>
Code: Select all
<?php $slug = $page->slug();
echo 'slug='.$slug;
?>
Code: Select all
<?php
if ($page->isStatic() && $slug=='thePageYouWant') {
include "pathToTheCode.php";
}
?>
That's interesting, it would solve my "problem". Do you know which is the php-condition to show the tags only to a specific page-url-slug?
Thank you very much for the suggestion!arfa wrote: ↑Thu Oct 17, 2024 11:00 pm There is a snippet plugin: PHP Shortcode Snippets ($4)
I haven't tried it but it could work for you.
On the template add:Load any page and this will show you/confirm which page you are on.Code: Select all
<?php $slug = $page->slug(); echo 'slug='.$slug; ?>
Then you can try in the template something like:I haven't tested this but used versions of it so it should work.Code: Select all
<?php if ($page->isStatic() && $slug=='thePageYouWant') { include "pathToTheCode.php"; } ?>
@Zebraslive
Code: Select all
<?php
if($WHERE_AM_I == 'page' && !empty($page->template())) {
include(THEME_DIR_PHP . $page->template() . '.php');
}
?>
Code: Select all
<?php
$items = getTags();
foreach ($items as $tag) {
echo '<p>' . $tag->name() . '</p>';
}
?>
You have two possiblities.
Code: Select all
<?php
if ($page->slug() == "page-url-slug") {
$items = getTags();
foreach ($items as $tag) {
echo 'Tag name: ' . $tag->name();
}
}
?>
Code: Select all
if ($WHERE_AM_I == 'page') {
if ($page->slug() == "page-url-slug") {
include(THEME_DIR_PHP.'page-url-slug.php');
}
else {
include(THEME_DIR_PHP.'page.php');
}
} else {
include(THEME_DIR_PHP.'home.php');
}