-
Notifications
You must be signed in to change notification settings - Fork 16
Writing a custom page template
There are several php functions that you can use in your theme to write a custom page template.
Related documents:
Returns the article list related to currently visited page. Will return false if we're not visiting a page or if the the page doesn't have a related article list.
Tells whether or not we're visiting a page that has a related article list.
Tells whether or not we're visiting a page that has a related article list and that the version of the list is a preview version.
Function that displays a link to wp-admin where currently visited article list can be edited
This function is not needed unless your're programmatically rendering the list
This function is available as of version 2.8. Use this function to load an article list. The parameter $version can be either the ID number of a certain version or the string 'preview' if you want to load the latest preview version of the list. Set variable $include_future_post to true if you want the list to include articles that is connected to future posts.
Here's a piece of example code for a custom page template that you can use in your theme. Name the file page-arlima.php
<?php
/**
* Template Name: Article List Page
* -------------------------------------
*/
get_header();
?>
<div id="primary" class="arlima-content">
<div id="content" role="main">
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php if( !arlima_has_list() ): ?>
<header class="entry-header">
<h1 class="entry-title"><?php the_title(); ?></h1>
</header>
<?php endif; ?>
<?php if( arlima_is_preview() ): ?>
<p class="arlima-preview-notice arlima-edit-list">
This is a preview of article list
"<?php echo get_arlima_list()->getTitle() ?>"
<a href="<?php the_permalink() ?>">Click here to reload latest published version</a>
</p>
<?php elseif( arlima_has_list() ): ?>
<?php arlima_edit_link(); ?>
<?php endif; ?>
<div class="arlima-content">
<?php the_content(); ?>
</div>
<footer class="entry-meta">
<?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
</footer>
</article><!-- #post-<?php the_ID(); ?> -->
</div>
</div>
<?php
get_sidebar();
get_footer();
This Wordpress plugin was created by Swedish newspaper Västerbottens-Kuriren to give its editorial staff an easy to use tool for customizing the front pages of their online magazines.
- Download the latest release from github and unzip the folder in your plugin directory.
- Open up wp-admin and activate the plugin.
- Go to "Article lists" -> "Edit lists" in wp-admin and create your first article list.
- Open up a page (or create it) in wp-admin. Down to the right you will see a meta box labeled "Arlima" where you choose the list that you created on step 2.
- Go to "Article lists" -> "Manage lists" and start stuffing your article list with interesting content.