Skip to content

Instantly share code, notes, and snippets.

@scottnix
scottnix / gist:3824683
Created October 3, 2012 02:54
Remove Thematic Bookmark info from single post
function childtheme_override_postfooter() {
$post_type = get_post_type();
$post_type_obj = get_post_type_object($post_type);
// Check for "Page" post-type and logged in user to show edit link
if ( $post_type == 'page' && current_user_can('edit_posts') ) {
$postfooter = '<div class="entry-utility">' . thematic_postfooter_posteditlink();
$postfooter .= "</div><!-- .entry-utility -->\n";
// Display nothing for logged out users on a "Page" post-type
} elseif ( $post_type == 'page' ) {
@scottnix
scottnix / gist:3830539
Created October 3, 2012 23:26
Thematic override for postconnect on v1.0.1
function childtheme_override_postfooter_postconnect() {
if ((comments_open()) && (pings_open())) { /* Comments are open */
$postconnect = ' <a class="comment-link" href="#respond" title ="' . __('Post a comment', 'thematic') . '">' . __('Post a comment', 'thematic') . '</a>';
$postconnect .= __(' or leave a trackback: ', 'thematic');
$postconnect .= '<a class="trackback-link" href="' . get_trackback_url() . '" title ="' . __('Trackback URL for your post', 'thematic') . '" rel="trackback">' . __('Trackback URL', 'thematic') . '</a>.';
} elseif (!(comments_open()) && (pings_open())) { /* Only trackbacks are open */
$postconnect = __(' Comments are closed, but you can leave a trackback: ', 'thematic');
$postconnect .= '<a class="trackback-link" href="' . get_trackback_url() . '" title ="' . __('Trackback URL for your post', 'thematic') . '" rel="trackback">' . __('Trackback URL', 'thematic') . '</a>.';
} elseif ((comments_open()) && !(pings_open())) { /* Only
@scottnix
scottnix / gist:3831587
Created October 4, 2012 05:05
Add Facebook comment count to Thematic
// scottnix.com
// add facebook comment count to Thematic, really we are just removing the lines that thematic customizes and adding back in the WP defaults
function childtheme_override_postfooter() {
$post_type = get_post_type();
$post_type_obj = get_post_type_object($post_type);
// Check for "Page" post-type and logged in user to show edit link
if ( $post_type == 'page' && current_user_can('edit_posts') ) {
$postfooter = '<div class="entry-utility">' . thematic_postfooter_posteditlink();
$postfooter .= "</div><!-- .entry-utility -->\n";
@scottnix
scottnix / gist:3836580
Created October 4, 2012 21:29
Thematic Shortcode for different sliders for pages
function snix_childtheme_gallery() { ?>
<div class="custom-gallery">
<?php
if ( is_front_page() ) {
echo do_shortcode("[shortcode 1]");
} elseif ( is_page( 42 ) ) {
echo do_shortcode("[shortcode 2]");
} elseif ( is_page( 43 ) ) {
echo do_shortcode("[shortcode 3]");
} else {
@scottnix
scottnix / gist:3837390
Created October 5, 2012 00:45
Thematic Facebook Comments, this time without the iframe.
// facebook connect functionality....
function childtheme_override_postfooter() {
$post_type = get_post_type();
$post_type_obj = get_post_type_object($post_type);
// Check for "Page" post-type and logged in user to show edit link
if ( $post_type == 'page' && current_user_can('edit_posts') ) {
$postfooter = '<div class="entry-utility">' . thematic_postfooter_posteditlink();
$postfooter .= "</div><!-- .entry-utility -->\n";
// Display nothing for logged out users on a "Page" post-type
@scottnix
scottnix / gist:3837878
Created October 5, 2012 03:26
Thematic Fourth Subsidiary Widget, above subs though.
// add 4th subsidiary aside widget, currently set up to be a footer widget underneath the 3 subs
function childtheme_add_subsidiary($content) {
$content['Footer Widget Aside'] = array(
'admin_menu_order' => 250,
'args' => array (
'name' => 'Banner Aside',
'id' => '4th-subsidiary-aside',
'description' => __('The 4th bottom widget area in the footer.', 'thematic'),
'before_widget' => thematic_before_widget(),
'after_widget' => thematic_after_widget(),
@scottnix
scottnix / gist:3840934
Created October 5, 2012 16:49
Example of adding a shortcode using custom fields "custom-gallery"
function snix_childtheme_gallery() {
global $post;
// display this only on pages
if (is_page()) {
// get the correct custom field data
$custom_gallery = get_post_meta($post->ID, 'custom-gallery', true);
// if custom field is available, do this
if ($custom_gallery) {
// do_shortcode is needed
@scottnix
scottnix / gist:3909999
Created October 18, 2012 05:21
Thematic Two Access Menus in Header
// register two additional custom menu slots
function childtheme_register_menus() {
if ( function_exists('register_nav_menu')) {
register_nav_menu('secondary-menu', 'Secondary Menu');
register_nav_menu('tertiary-menu', 'Tertiary Menu');
}
}
add_action('init', 'childtheme_register_menus');
///Top Menu (optional)
@scottnix
scottnix / gist:3914654
Created October 18, 2012 20:53
Thematic change post order, blog and archive examples
// there are 2 seperate examples here, one is for the home/blog posts, the other is for archives
// change order of posts in the blog/home section or front page
// http://codex.wordpress.org/Function_Reference/query_posts
function childtheme_home_post_order() {
if ( is_home() || is_front_page() ) {
global $query_string;
query_posts($query_string . '&orderby=date&order=asc'); // example of order by date, starting oldest first
// query_posts($query_string . '&orderby=title&order=asc'); // example of order by title, starting a-z
}
@scottnix
scottnix / gist:3925533
Created October 21, 2012 02:52
Swap Thematic Meta Data to be on top of Title.
function childtheme_override_postheader() {
global $post;
if ( is_404() || $post->post_type == 'page') {
$postheader = thematic_postheader_posttitle();
} else {
$postheader = thematic_postheader_postmeta() . thematic_postheader_posttitle();
}
echo apply_filters( 'thematic_postheader', $postheader ); // Filter to override default post header