Skip to content

Instantly share code, notes, and snippets.

@daveis
daveis / article-next-prev-titles-function.php
Created September 20, 2014 15:21
Returns the prev/next article title while reading an article in Anchor CMS. Goes in your theme's functions.php file
// Return next and previous article titles
function dg_article_previous_title() {
$page = Registry::get('posts_page');
$query = Post::where('created', '<', Registry::prop('article', 'created'))
->where('status', '!=', 'draft');
if($query->count()) {
$article = $query->sort('created', 'desc')->fetch();
$page = Registry::get('posts_page');
@daveis
daveis / article-prev-next-titles.php
Created September 20, 2014 15:13
Prev/Next article titles in article.php for my Manifesto theme in Anchor CMS
<nav class="pagination container clearfix">
<a<?php echo (article_previous_url() ? ' href="' . article_previous_url() . '"' : ''); ?>>
<i class="fa fa-chevron-circle-left"></i><span> <?php echo dg_article_previous_title(); ?></span>
</a>
<a<?php echo (article_next_url() ? ' href="' . article_next_url() . '"' : ''); ?>>
<span><?php echo dg_article_next_title(); ?> </span><i class="fa fa-chevron-circle-right"></i>
</a>
</nav>
@daveis
daveis / posts.php
Last active December 30, 2015 15:19
A modified version of posts.php from my Anchor theme: Manifesto. (https://github.com/daveis/manifesto-anchor-theme) This code will show the latest article - with just the image, heading, description, and read more link - on the homepage, posts page, and category pages.
<?php theme_include('header'); ?>
<div class="content-bg">
<section class="article-posts">
<!-- Check for posts -->
<?php if(has_posts()): ?>
<!-- Show the full version of most recent post ->
@daveis
daveis / posts.php
Created December 7, 2013 20:03
A modified version of posts.php from my Anchor theme: Manifesto. (https://github.com/daveis/manifesto-anchor-theme) This code will show the latest full-length article on the homepage, posts page, and category pages.
<?php theme_include('header'); ?>
<div class="content-bg">
<section class="article-posts">
<!-- Check for posts -->
<?php if(has_posts()): ?>
<!-- Show the full version of most recent post ->