Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ryelle/one-page-layout
A quick plugin to manage "one-page" layouts in WordPress
https://github.com/ryelle/one-page-layout
Last synced: about 1 month ago
JSON representation
A quick plugin to manage "one-page" layouts in WordPress
- Host: GitHub
- URL: https://github.com/ryelle/one-page-layout
- Owner: ryelle
- Created: 2015-01-14T21:02:25.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-01-14T22:39:57.000Z (almost 10 years ago)
- Last Synced: 2024-10-09T23:21:03.642Z (3 months ago)
- Language: PHP
- Size: 125 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
One Page Layouts
================This is a plugin for theme developers. When used with the Menu Customizer, it gives you a way to manage a "one-page" site of content blocks in the customizer.
### How to set up (in code)
Set up via `add_theme_support`. Here are the defaults:
add_theme_support( 'one-page-layout', array(
',
'menu-name' => __( 'One Page Layout', 'one-page' ),
'posts-template' => 'content',
'custom-format' => '
'archive-template' => 'content',
'archive-before' => '',%3$s
',
'archive-after' => '
'archive-count' => '6',
) );Since menus can contain posts, pages, taxonomy archives, and custom links, the configuration is a little involved. For displaying posts & pages, we grab the template defined in `posts-template` (content.php by default).
Taxonomy archives are trickier. They're wrapped in `archive-before` and `archive-after`. The placeholders in `archive-before` are 1: an ID, 2: the taxonomy being displayed, 3: the name of this taxonomy. Each post in the archive is displayed with `archive-template` (content.php, again). It'll only display `archive-count` posts. Note: does not take into account non-post post types.
Lastly, custom links are output from a format string; 1: an ID, 2: the URL, 3: link title, and 4: description.
### How to set up (in WordPress)
Create a new menu with the pages/posts/categories etc that you want on your front page. Set this menu to the "One Page Layout" menu location (theme devs can rename this).
### Displaying your layout
Use this function in your template, most likely front-page.php, instead of the loop.
If you're using [Menu Customizer](https://github.com/voldemortensen/menu-customizer), you can jump into the customizer and add/manage items in the menu, and see your changes in real-time.
### Try it out
Download ["One Page Aventurine"](https://cloudup.com/cMikaM9p2Oa), a child theme of [Aventurine](https://wordpress.org/themes/aventurine), a quick proof-of-concept for how to use this in a theme.