2017-05-03, 22:30:31
@Shasaar: I have the Special Pages fields working as expected, but there are some things I still don't understand.
I have modified an existing site template to accept either normal pages or special pages, so there is some extra code that is not essential. There is no code in the 'View' tab for the Special Page. The Special Page has only one extra field ('sidebar'), set as WYSIWYG. This is the main body of the template:
While I was testing, I had a lot of frustration from changes that did not make any difference. It is essential to clear the browser cache and GS cache (admin->settings->'Flush all caches') frequently, even if you think it should not be necessary.
Even with frequent cache flushing, sometimes changes to the template file are not reflected in the output to the page. To force template changes, I found it necessary to change the page template setting for the Special Page (Edit Special Page type->Page Template), save the setting and then change the template back again. This may be because of the caching in the plugin: I was making changes to the template without changing the pages. If you make a new page, this may not be a problem.
I have modified an existing site template to accept either normal pages or special pages, so there is some extra code that is not essential. There is no code in the 'View' tab for the Special Page. The Special Page has only one extra field ('sidebar'), set as WYSIWYG. This is the main body of the template:
PHP Code:
<div id="page">
<h1><?php get_page_title(); ?></h1>
<?php
// Echoes main content field for special pages or main page content
get_special_field('content') || get_page_content();
?>
</div>
<div id="sidebar">
<?php
// Echoes sidebar text for special pages, if it exists,
// otherwise echoes the default sidebar 'sb-default' (normal page).
get_special_field('sidebar') || get_i18n_content('sb-default');
?>
</div>
While I was testing, I had a lot of frustration from changes that did not make any difference. It is essential to clear the browser cache and GS cache (admin->settings->'Flush all caches') frequently, even if you think it should not be necessary.
Even with frequent cache flushing, sometimes changes to the template file are not reflected in the output to the page. To force template changes, I found it necessary to change the page template setting for the Special Page (Edit Special Page type->Page Template), save the setting and then change the template back again. This may be because of the caching in the plugin: I was making changes to the template without changing the pages. If you make a new page, this may not be a problem.
--
Nick.
Nick.