Skip to content

Commit

Permalink
Page Theme Options
Browse files Browse the repository at this point in the history
  • Loading branch information
cogdog committed Jun 19, 2019
1 parent 0420d89 commit 7d3f6ac
Show file tree
Hide file tree
Showing 10 changed files with 654 additions and 892 deletions.
24 changes: 20 additions & 4 deletions README.md
Expand Up @@ -129,11 +129,11 @@ You can also get a copy of the Widgets used on that site too. First intall/activ
### Page Setup
This theme has several pages that must be created; each is associated with a specific template that provide it's functionality. Activating the theme *should* create these all for you when the theme is activated, but if not, create them as described below. You can edit the content of the **Write** and **Desk** pages to customize the prompt seen by writers on your site.

If the theme does not do so automatically (and it should) create these Wordpress **Pages**. You can modify the titles, and add whatever content you want to appear at the top as instructions, but do not change the slug or short name.
If the theme does not do so automatically (and it should) create these Wordpress **Pages**. You can modify the titles, and add whatever content you want to appear at the top as instructions. As of version 1.8, you can edit the url short name as well.

* **Write** -- The page that provides the writing form see [http://splot.ca/writer/write](http://splot.ca/writer/write). You can title it whatever you like, but the slug (url name) must be `write` Whatever you include in the body (not required) is added to the top of the form, maybe for extra instructions.e.g. for a site at `http://coolest.site.org/` the page must be published at `http://coolest.site.org/write`
* **Write** -- The page that provides the writing form, see [http://splot.ca/writer/write](http://splot.ca/writer/write). Whatever you include in the body (not required) is added to the top of the form, maybe for extra instructions.e.g. for a site at `http://coolest.site.org/` the page can be published at `http://coolest.site.org/writing` When you create a Writing Form page, under **Page Atributes**, select the Template named `Writing Pad`

* **Desk** -- The page that provides users will see first if they must enter an access code to access the writing tool (see below). If no access code is required, it redirects to the page above for the writing form-- like [http://splot.ca/writer/desk](http://splot.ca/writer/desk). You can title it whatever you like, but the slug (url name) must be `desk` Whatever you include in the body (not required) is added to the top of the form, maybe for a friendly prompt .e.g. for a site at `http://coolest.site.org/` the page must be published at `http://coolest.site.org/desk`
* **Desk** -- The page that provides users will see first if they must enter an access code to access the writing tool (see below). If no access code is required, it redirects to the page above for the writing form-- like [http://splot.ca/writer/desk](http://splot.ca/writer/desk). Whatever you include in the body (not required) is added to the top of the form, maybe for a friendly prompt .e.g. for a site at `http://coolest.site.org/` the page might be published at `http://coolest.site.org/guard_dog` When you create a Writing Form page, under **Page Atributes**, select the Template named `Welcome Desk`


### Customize Your Menus
Expand Down Expand Up @@ -170,6 +170,19 @@ The TRU Writer is a moderated publishing theme. And "moderated" means that when

In order to make a post (or "writing" as above) visible, a user with the permission status of "Editor" or "Administrator" needs to change the status of the "pending approval" writing to "published (or ignore an "Editor" or "Administrator" could just ignore it forever, such power is theirs).

#### Pages Setup

Use this area to assign the WordPress Page to be used for the Welcome Desk (where users are sent if there is a required access code) as well as the Page for the writing form. With version 1.8 of TRU Writer, you can now use any name you want for the URL (previously these were forced to be `write` and `desk`-- this is no longer required.

If no Pages are found with the correct template, you will see a prompt to create one:

![](images/pages-make.jpg)

If pages are found (and there might even be more than one, you can select the one you want used for each special page.

![](images/pages-setup.jpg)


#### Publish Options

![](images/publish-options1.jpg)
Expand Down Expand Up @@ -281,9 +294,12 @@ You can copy and paste from that .txt file into the import field of the settings

## Relatively Cool New Features & Updates


**Options for Special Pages** No longer are pages for the Welcome Desk (where access codes are entered) and Writer form required to have a set URL; you can create any Page desired for these functions, and set them as the active ones via the theme options.

**Better Front End Editor** Reduced reliance on special pages. The links to the random entry and the one use to get the edit link are no longer needed, and are handle now in the code. These pages should be deleted from your site. On an update to version 1.7 or later, you might have to go to **Settings** - **Permalinks** and just click save to update the url rules. Also the method for using the special link to edit an entry is now done in a single click. Much better!

**Better Front End Editor** Customizer options for choosing a this or wider content layout. URLs for media that [WordPress natively can oembed](https://codex.wordpress.org/Embeds#Okay.2C_So_What_Sites_Can_I_Embed_From.3F) will now do so in the front end editor.
**Better Layout and Media Support** Customizer options for choosing a this or wider content layout. URLs for media that [WordPress natively can oembed](https://codex.wordpress.org/Embeds#Okay.2C_So_What_Sites_Can_I_Embed_From.3F) will now do so in the front end editor.

![](images/autoembed-splot-editor.gif)

Expand Down
52 changes: 51 additions & 1 deletion class.truwriter-theme-options.php
Expand Up @@ -148,7 +148,57 @@ public function get_settings() {
'type' => 'text',
'section' => 'general'
);


$this->settings['pages_heading'] = array(
'section' => 'general',
'title' => '', // Not used for headings.
'desc' => 'Pages Setup',
'std' => '',
'type' => 'heading'
);

// get all pages on site with template for the Writing Desk
$found_pages = get_pages_with_template('page-desk.php');

// the function returns an array of id => page title, first item is the menu selection item
if ( count( $found_pages ) > 1 ) {
$page_desc = 'Set the Page that should be used for the access code entry.';
$page_std = array_keys( $found_pages)[1];
} else {
$page_desc = 'No pages have been created with the Writing Desk template. This is required to enable access to the writing form. <a href="' . admin_url( 'post-new.php?post_type=page') . '">Create a new Page</a> and under <strong>Page Attributes</strong> select <code>Writing Desk</code> for the Template.';
$page_std = '';
}

$this->settings['desk_page'] = array(
'section' => 'general',
'title' => __( 'Page For Access Code (Writing Desk)'),
'desc' => $page_desc,
'type' => 'select',
'std' => $page_std,
'choices' => $found_pages
);

// get all pages on site with template for the Writing Form
$found_pages = get_pages_with_template('page-write.php');

// the function returns an array of id => page title, first item is the menu selection item
if ( count( $found_pages ) > 1 ) {
$page_desc = 'Set the Page that should be used for the Writing form.';
$page_std = array_keys( $found_pages)[1];
} else {
$page_desc = 'No pages have been created with the Writing Pad template. This is required to enable access to the writing form. <a href="' . admin_url( 'post-new.php?post_type=page') . '">Create a new Page</a> and under <strong>Page Attributes</strong> select <code>Writing Pad</code> for the Template.';
$page_std = '';
}

$this->settings['write_page'] = array(
'section' => 'general',
'title' => __( 'Page For Writing Form (Writing Pad)'),
'desc' => $page_desc,
'type' => 'select',
'std' => $page_std,
'choices' => $found_pages
);


$this->settings['publish_heading'] = array(
'section' => 'general',
Expand Down

0 comments on commit 7d3f6ac

Please sign in to comment.