Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
page-content-blocks depending on the page
There is a page in the wiki with info about components depending on the page:

Can this also be done with pages? So I use different pages as content blocks instead of components, depending on the page.

It seams an easier way to do something similar by using the Simple Input Tabs, or I18N Custom Fields plugin, but I thought if I could do without a plugin.
Insert in theme's functions.php file:
PHP Code:
if (!function_exists('page_exists')) {
page_exists($slug) {
    if (
$slug) {
      if (isset(
$pagesArray[$slug]) || file_exists(GSDATAPAGESPATH.$slug.'.xml')) return true;

Example usage, for subpages named block-whatever (and a another block-default):
PHP Code:
if (page_exists('block-'.get_page_slug(false))) {
} else {
Thanks, that seems to work. It is a bit confusing though at first.
I just tried to do the same as the example in the wiki but for pages instead of components.
Wrapping the example into another function might make this a bit more clear.

Users browsing this thread: 1 Guest(s)