Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block clivewalker

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
clivewalker / related-posts.php
Created Sep 29, 2015
How to show related posts with Perch blog
View related-posts.php
clivewalker / 0_reuse_code.js
Created Dec 2, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
clivewalker / meta_head.html
Last active Dec 2, 2015
Perch template for Open Graph data
View meta_head.html
<meta property="og:site_name" content="<perch:setting id="perch_blog_site_name" />" />
<meta property="og:url" content="<perch:blog id="domain" type="hidden" /><perch:blog id="postURL" type="hidden" />" />
<perch:if exists="og_title"><!--* If Meta and Social tab data available (i.e Post saved), show this *-->
<meta property="og:title" content="<perch:blog id="og_title" label="Social title" type="text" escape="true" />" />
<meta property="og:description" content="<perch:blog id="og_description" label="Social description" type="textarea" size="s" escape="true" />" />
<perch:else/><!--* else, show the blog post title and excerpt *-->
<meta property="og:title" content="<perch:blog id="postTitle" type="text" escape="true" />" />
<meta property="og:description" content="<perch:blog id="excerpt" type="textarea" size="s" escape="true" />" />
</perch:if><!--* *-->
<perch:if exists="og_image">
View arrows-wth-css.html
<div class="arrow_box">
<h1 class="logo">css arrow please!</h1>
clivewalker / formselectoptions.html
Last active Dec 6, 2016
Perch snippet allowing CMS editors to change a select element in a form
View formselectoptions.html
<perch:label for="subject">Subject</perch:label>
<perch:input type="select" id="subject" options="<perch:content id="subject" type="text" label="Subject" help="Add subjects separated by commas" />" id="subjectoptions" />
clivewalker / after-content-hook.php
Last active Feb 8, 2017
Adding after post content with WP filter hook so that it's in RSS feed
View after-content-hook.php
function after_post_content($content) {
if(!is_feed() && !is_home()) {
$content.= '<h4>Like this post?</h4>';
$content.= '<p><a href="">Subscribe to our newsletter</a>!</p>';
return $content;
add_filter ('the_content', 'after_post_content');
clivewalker / config.js
Created Jul 24, 2017
Simple configuration file for default Redactor editor in Perch CMS. Minimal editor buttons. From
View config.js
Perch.UserConfig.redactor = function(){
var get = function(profile, config, field) {
return { buttons: ['bold', 'italic'] }
var load = function(cb) {
View heading-arrows.css
h1 {
background: #000000;
color: #FFFFFF;
font-size: 20px;
font-weight: bold;
padding: 5px;
position: relative;
h1:after {
border-color: #000000 transparent transparent;
clivewalker / sidebarcode.php
Last active Dec 6, 2017
Showing a blog post excerpt that isn't the current post in a sidebar using Perch CMS. Use this on your post page.
View sidebarcode.php
'filter' => 'postSlug',
'match' => 'neq',
'value' => perch_get('s'),
View excluding-categories.php
// We're grabbing each category and filtering the 'Properties' region using that category - if the property count is 0, we don't pass that category to the output.
// This method does produce a database query for each category, so I would run it with debug switched on to see if makes an impact for your setup or not.
<?php perch_categories(['set'=>'area','sort'=>'catTitle','sort-order'=>'ASC','each'=>function($item) {
if (PerchUtil::count(perch_content_custom('Properties',
['skip-template'=>true, 'category'=>$item['catPath']])) > 0) return $item; }]
); ?>
// You do have to make a slight change to the category template with this though - an example using the default category.html template:
You can’t perform that action at this time.