Author is Aleš Sýkora
Updated: 20. 9. 2022, Added: 25. 8. 2022
Display post categories without links in Oxygen builder
If you want display post categories without the links in repeater or in post page without link to the category archive, you can use the code below.
<?php
foreach (get_categories() as $category){
echo $category->name . ' ';
}
?>
If you want to change the separator, change this:
echo $category->name . ' ';
To whatever you want... for example:
echo $category->name . '||||||||||||my fancy separator||||||||||';
If you need to use this code on more than one page, I suggest you to create it as a function and put to the code snippets or advanced scripts plugin:
<?php function great_tit_catnames() {
foreach (get_categories() as $category){
echo $category->name . ' ';
}
}
?>
And then just add the Text block > Dynamic Data > PHP function return value and to the first input add the "great_tit_catnames". That will generate this Oxygen shortcode, which you can use sitewide with function in one place:
[oxygen data='phpfunction' function='great_tit_catnames']
Another solution would be using code block as a re-usable block.