Skip to content

Instantly share code, notes, and snippets.

@jdcauley
jdcauley / AnchorCMS ACE Editor
Last active December 17, 2015 19:28
Add Ace Editor to Anchor Post and Page Area
<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 December 17, 2015 19:49
Include WP Custom Posts in Category Pages
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 October 25, 2017 08:50
Wordpress Bootstrap Carousel using a custom Post
<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 December 19, 2015 11:59
Custom Post Function: All Options
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 December 20, 2015 18:28
Adds Lines lines to either side of a text item: - Title -
@fancy-color: #333;
.fancy{
overflow: hidden;
text-align: center;
span {
display: inline-block;
position: relative;
&:before, &:after {
content: "";
<!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 January 9, 2014 21:29
Add Menu Description to WP Nav
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 January 4, 2016 03:29
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(); ?>
<?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
.sidebar ul li{
list-style: none;
}
.sidebar .widget{
border-bottom: 1px solid #E9E9E9;
}
.sidebar .widget:last-child{
border-bottom: none;
}
.sidebar-border{