Skip to content

How to create your own defaults

Paul Ryley edited this page May 16, 2017 · 5 revisions

This optional file contains all configuration settings in a single file. You may edit it and place in either one directory above your webroot (recommended), or in the same location as your wp-config.php. If you choose the latter, make sure you add a rule to your .htaccess to disable access to the pollux.yml file from the browser.

If the pollux.yml file exists, Pollux with use it as the new plugin defaults.

You may also add a disable_config option to completely disable the Pollux Settings admin page UI.

Example pollux.yml file

disable_config: false
disable_posts: false
enable_archive_page: false
remove_dashboard_widgets: false
remove_wordpress_footer: false
remove_wordpress_menu: false

archives: []

columns: []

metaboxes:
  contact_options:
    post_types: page
    title: Contact Options
    condition:
      is_page_template: template-contact.php
    fields:
      address:
        type: text
        name: Address
        std: Hill of Tara, Meath, Ireland
        attributes:
          class: large-text
      location:
        type: map
        name: Location
        address_field: address
        std: 53.5788114, -6.613843, 15
        api_key: google_maps
      shortcode:
        type: text
        name: Custom Form
        placeholder: Enter a custom Contact Form shortcode here
        desc: Replace the default contact form by entering a custom contact form shortcode here.
        attributes:
          class: large-text
  gallery_options:
    post_types: page
    title: Gallery Options
    condition:
      is_page_template: template-gallery.php
    fields:
      gallery:
        type: post
        name: Gallery
        placeholder: Select a gallery
        field_type: select
        post_type: gallery
      images_per_page:
        type: number
        name: Images Per Page
        size: 4
      lazyload:
        type: checkbox
        name: Lazyload Images?
      pagination:
        type: checkbox
        name: Use Pagination?
  gallery_media:
    post_types: gallery
    title: Gallery Media
    fields:
      media:
        type: image_advanced

post_types:
  gallery:
    single: Gallery
    plural: Galleries
    menu_icon: dashicons-images-alt2
    supports:
      - title
    columns:
      - title
      - slug
      - media
      - date
    public: false

taxonomies:
  project_type:
    post_types: gallery
    single: Project
    plural: Projects

settings:
  global:
    title: SEO Settings
    fields:
      seo_enabled:
        type: checkbox
        name: Enable SEO?
      seo_title:
        type: text
        name: SEO Title (prefix)
        depends: seo_enabled
        attributes:
          class: large-text
      seo_description:
        type: textarea
        name: SEO Description
        depends: seo_enabled
        attributes:
          class: large-text
      seo_keywords:
        type: text
        name: SEO Keywords
        depends: seo_enabled
        attributes:
          class: large-text
      robots:
        name: Robots
        desc: <a href="http://www.robotstxt.org/meta.html" target="_blank">What is this?</a>
        type: select
        default: index, follow
        options:
          - index, follow
          - index, nofollow
          - noindex, follow
          - noindex, nofollow
  contact:
    title: Contact Details
    fields:
      email:
        type: text
        name: Email
  services:
    title: 3rd Party Services
    fields:
      google_analytics:
        type: text
        name: Google Analytics ID
        desc: <a href="https://www.google.com/analytics/" target="_blank">What is this?</a>
        placeholder: UA-XXXXXXXX-Y
      google_maps:
        type: text
        name: Google Maps API key
        desc: <a href="https://developers.google.com/maps/documentation/javascript/get-api-key" target="_blank">What is this?</a>
    validation:
      rules:
        google_analytics:
          required: true
          minlength: 5
      messages:
        google_analytics:
          required: A Google Analytics ID is required
Clone this wiki locally