Skip to content

Instantly share code, notes, and snippets.

@jdcauley
jdcauley / AnchorCMS ACE Editor
Last active Dec 17, 2015
Add Ace Editor to Anchor Post and Page Area
View AnchorCMS ACE Editor
<style type="text/css" media="screen">
#editor {
position: relative;
height: 400px;
}
</style>
<div id="editor"></div>
<fieldset class="main">
<div class="wrap">
<?php echo Form::textarea('html', Input::previous('html', $article->html), array(
@jdcauley
jdcauley / Custom Posts in Category
Last active Dec 17, 2015
Include WP Custom Posts in Category Pages
View Custom Posts in Category
function namespace_add_custom_types( $query ) {
if( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) {
$query->set( 'post_type', array(
'post', 'nav_menu_item', 'your-custom-post-type-here'
));
return $query;
}
}
add_filter( 'pre_get_posts', 'namespace_add_custom_types' );
@jdcauley
jdcauley / Custom Post Slider
Last active Oct 25, 2017
Wordpress Bootstrap Carousel using a custom Post
View Custom Post Slider
<div id="myCarousel" class="carousel slide">
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
<li data-target="#myCarousel" data-slide-to="3"></li>
<li data-target="#myCarousel" data-slide-to="4"></li>
</ol>
<div class="carousel-inner">
<?php query_posts('post_type=features&showposts=1'); ?>
@jdcauley
jdcauley / WP Custom Posts
Last active Dec 19, 2015
Custom Post Function: All Options
View WP Custom Posts
function my_custom_post() {
register_post_type( 'my_custom_post',
array(
'labels' => array(
'name' => __( 'Custom Post' ),
'singular_name' => __( 'Custom_Post' )
),
'public' => true,
'has_archive' => true,
'supports' => array('title', 'editor', 'thumbnail', 'custom-fields'),
@jdcauley
jdcauley / fancy-h-tag.less
Last active Dec 20, 2015
Adds Lines lines to either side of a text item: - Title -
View fancy-h-tag.less
@fancy-color: #333;
.fancy{
overflow: hidden;
text-align: center;
span {
display: inline-block;
position: relative;
&:before, &:after {
content: "";
View gist:6699805
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Redirecting...</title>
<!------------------------------------------------------------------
MaxMind's GeoIP JavaScript API
@URL: http://dev.maxmind.com/geoip/javascript
-------------------------------------------------------------------->
<script src="//j.maxmind.com/app/country.js" charset="ISO-8859-1"></script>
@jdcauley
jdcauley / WP-Menu-Description
Created Jan 9, 2014
Add Menu Description to WP Nav
View WP-Menu-Description
add_filter( 'walker_nav_menu_start_el', 'gt_add_menu_item_description', 10, 4);
function gt_add_menu_item_description( $item_output, $item, $depth, $args ) {
$desc = __( $item->post_content );
return preg_replace('/(<a.*?>[^<]*?)</', '$1' . "<span>{$desc}</span><", $item_output);
}
@jdcauley
jdcauley / Custom Post Loop
Last active Jan 4, 2016
Custom Post Loop
View Custom Post Loop
<div class="row">
<?php query_posts('showposts=4'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="col-sm-4 recent-entry">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<?php the_excerpt(); ?>
<a href="<?php the_permalink(); ?>">Continued</a>
</div>
<?php endwhile; endif; ?>
<?php wp_reset_query(); ?>
View Border Side Bar for roots.io
<?php get_template_part('templates/head'); ?>
<body <?php body_class(); ?>>
<!--[if lt IE 8]>
<div class="alert alert-warning">
<?php _e('You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.', 'roots'); ?>
</div>
<![endif]-->
<?php
View Sidebar-border CSS
.sidebar ul li{
list-style: none;
}
.sidebar .widget{
border-bottom: 1px solid #E9E9E9;
}
.sidebar .widget:last-child{
border-bottom: none;
}
.sidebar-border{