Skip to content

Instantly share code, notes, and snippets.

@scottnix
scottnix / gist:5945714
Last active December 19, 2015 11:09
Thematic Theme Custom Walker Adds description to Thematic Menu (#access/primary menu)
<?php
// updated working version, adds menu description in span tags
// reference: http://forums.themeshaper.com/topic/thematic-menus-demystified-1
class Custom_Walker extends Walker_Nav_Menu {
function start_el(&$output, $item, $depth, $args) {
global $wp_query;
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
$class_names = $value = '';
@scottnix
scottnix / gist:5944519
Last active December 19, 2015 10:59
Thematic make full post in a certain category clickable. Need JS for this, tries to close any actual link tags.
// make whole post clickable on the index page by adding JavaScript to only that category
// also add a cursor: pointer; in CSS to the div/category
// reference: http://thematictheme.com/forums/topic/wrap-entry-content-in-anchor-tags/
function childtheme_override_index_loop() {
// Count the number of posts so we can insert a widgetized area
$count = 1;
while ( have_posts() ) : the_post();
@scottnix
scottnix / gist:5844103
Created June 23, 2013 06:57
Responsive version of shortcode columns for WordPress. Haven't tested in ages, based on http://scottnix.com/wordpress-columns-shortcode/
function snix_clean_shortcodes($content) {
$array = array (
'<p>[' => '[',
']</p>' => ']',
']<br />' => ']'
);
$content = strtr($content, $array);
return $content;
}
@scottnix
scottnix / gist:5828672
Created June 21, 2013 03:53
Thematic and ACF example. Uses custom fields, a conditional and set on a hook that is inside the loop.
// example of using ACF custom fields, with conditionals
// this has to be set inside the loop, not sure how to place one anywhere yet (haven't needed it)
function childtheme_acf_additions() {
if (is_single()) { ?>
<ul class="toggle-specs c-engine">
<h3 class="expand">Engine Specs <i class="">+</i></h3>
<div class="panel">
<?php
if(get_field('c_engine')) {
echo '<li><span>Engine:</span> ' . get_field('c_engine') . '</li>';
@scottnix
scottnix / gist:5816616
Created June 19, 2013 18:24
caroufredsel slider setup for Thematic Theme responsive setup, images 1250x425 with post title as caption this runs by tagging a post featured.
/* css */
.slider {
margin: 1.625em 0;
}
.slider ul {
margin: 0;
padding: 0;
}
@media (min-width: 680px) {
@scottnix
scottnix / gist:5790772
Last active December 18, 2015 13:29
Thematic remove Author information from postheader (filter example)
<?php
// reference http://thematictheme.com/forums/topic/making-minor-amendments-to-templates/
// reference override example (same thing, different way to do it). I prefer the filter. https://gist.github.com/scottnix/5790774
// remove the author information from all posts using a filter
function childtheme_postheader_postmeta($postmeta) {
$postmeta = "\n\t\t\t\t\t";
$postmeta .= '<div class="entry-meta">' . "\n\n";
$postmeta .= "\t" . thematic_postmeta_entrydate() . "\n\n";
$postmeta .= "\t" . thematic_postmeta_editlink() . "\n\n";
@scottnix
scottnix / gist:5790774
Last active December 18, 2015 13:29
Thematic remove Author information from postheader (override example).
<?php
// reference http://thematictheme.com/forums/topic/making-minor-amendments-to-templates/
// reference filter example (same thing, different way to do it). I prefer the filter. https://gist.github.com/scottnix/5790774
// remove the author information from all posts using the child theme override functionality
function childtheme_override_postheader_postmeta() {
$postmeta = "\n\t\t\t\t\t";
$postmeta .= '<div class="entry-meta">' . "\n\n";
$postmeta .= "\t" . thematic_postmeta_entrydate() . "\n\n";
$postmeta .= "\t" . thematic_postmeta_editlink() . "\n\n";
@scottnix
scottnix / gist:5536984
Created May 7, 2013 23:20
Cleaned Slider Variation for a forum post.
// reference - http://thematictheme.com/forums/topic/returntrue-nivo-slider-example-using-the-same-pattern-but-with-anythingslider/
function wicked_slider_frontpage() {
if (is_front_page()) { ?>
<ul class="slider theme-default">
<?php
$tmp = $wp_query;
$wp_query = new WP_Query('posts_per_page=5&#038;category_name=featured');
if($wp_query->have_posts()) {
while($wp_query->have_posts()) :
$wp_query->the_post();
@scottnix
scottnix / gist:5536807
Created May 7, 2013 22:50
Removes the Deprecated Templates from the dropdowns in the Page Admin screens in WordPress
// remove the deprecated options from the Page Template menu in WordPress Admin
// this removes them in both sections, the main edit screen and the quick edit opion using jQuery
// http://wordpress.stackexchange.com/questions/13671/how-to-remove-a-parent-theme-page-template-from-a-child-theme
function wpse_13671_script_enqueuer() {
global $current_screen;
/**
* /wp-admin/edit.php?post_type=page
*/
if('edit-page' == $current_screen->id)
@scottnix
scottnix / gist:5505052
Created May 2, 2013 20:15
Thematic conditionals on category loop with an override.
// override the category loop
// http://thematictheme.com/forums/topic/post-listing-without-thumbnails/
function childtheme_override_category_loop() {
if ( is_category('blog') ) {
while ( have_posts() ) : the_post();
// your custom blog loop
// reference thematic/library/extensions/content-extensions.php where the original loop resides.
endwhile;