'e3e3e3',
'default-image' => get_template_directory_uri() . '/images/bg.jpg'
) ) );
// Add support for custom header
add_theme_support( 'custom-header', apply_filters( 'pinktouch_custom_header_args', array(
'default-text-color' => '000',
'width' => 690,
'height' => 185,
'wp-head-callback' => 'pinktouch_header_style',
'admin-head-callback' => 'pinktouch_admin_header_style',
) ) );
}
add_action( 'after_setup_theme', 'pinktouch_setup' );
// Header style for front-end.
function pinktouch_header_style() {
if ( HEADER_TEXTCOLOR == get_header_textcolor() && '' == get_header_image() )
return;
?>
Header admin panel.
function pinktouch_admin_header_style() {
?>
1,
) );
// Count the number of categories that are attached to the posts.
$all_the_cool_cats = is_countable( $all_the_cool_cats ) ? count( $all_the_cool_cats ) : 0;
set_transient( 'all_the_cool_cats', $all_the_cool_cats );
}
return $all_the_cool_cats;
}
// Register widgetized area and update sidebar with default widgets.
function pinktouch_widgets_init() {
register_sidebar( array(
'name' => __( 'Footer Area One', 'pinktouch' ),
'id' => 'sidebar-1',
'description' => __( 'An optional widget in the footer', 'pinktouch' ),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer Area Two', 'pinktouch' ),
'id' => 'sidebar-2',
'description' => __( 'An optional widget in the footer', 'pinktouch' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer Area Three', 'pinktouch' ),
'id' => 'sidebar-3',
'description' => __( 'An optional widget in the footer', 'pinktouch' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'pinktouch_widgets_init' );
// Show post data for use in loop.
function pinktouch_post_data() { ?>
%3$s in %4$s', 'pinktouch' ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'pinktouch' ), get_the_author() ) ),
get_the_author(),
get_the_category_list( __( ', ', 'pinktouch' ) )
);
?>
%3$s', 'pinktouch' ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'pinktouch' ), get_the_author() ) ),
esc_html( get_the_author() )
);
?>
Tags: ', 'pinktouch' ), ', ', '' ); ?>
', '' ); ?>
max_num_pages > 1 ) : ?>
' . __( 'Continue reading →', 'pinktouch' ) . '';
}
// Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and pinktouch_continue_reading_link().
function pinktouch_auto_excerpt_more( $more ) {
return ' …' . pinktouch_continue_reading_link();
}
add_filter( 'excerpt_more', 'pinktouch_auto_excerpt_more' );
// Adds a pretty "Continue Reading" link to custom post excerpts.
function pinktouch_custom_excerpt_more( $output ) {
if ( has_excerpt() && ! is_attachment() ) {
$output .= pinktouch_continue_reading_link();
}
return $output;
}
add_filter( 'get_the_excerpt', 'pinktouch_custom_excerpt_more' );
// Show author info.
function pinktouch_author_info() { ?>
comment_type || 'trackback' == $comment->comment_type ) : ?>
id="comment-">
]*?href=[\'"](.+?)[\'"]/is', $the_content, $matches ) )
return false;
return esc_url_raw( $matches[1] );
}
} // if ( ! function_exists( 'pinktouch_url_grabber' ) )
if ( function_exists( 'get_the_post_format_media' ) && ! function_exists( 'pinktouch_audio_grabber' ) ) :
/**
* Return the first audio file found for a post.
*
* @param int $post_id ID for parent post.
* @return string Path to audio file.
*/
function pinktouch_audio_grabber( $post_id ) {
$null = null;
preg_match( '/src=[\'"](.+?)[\'"]/is', get_the_post_format_media( 'audio', $null, 1 ), $matches );
return isset( $matches[1] ) ? esc_url( $matches[1] ) : '';
}
endif;
/**
* Get a short-form mime type for an audio file to display as a class attribute.
*
* @param int ID of an attachment
* @return string A short representation of the file's mime type.
*/
function pinktouch_post_classes( $classes ) {
if ( has_post_format( 'audio' ) ) {
$audio = pinktouch_audio_grabber( get_the_ID() );
if ( ! empty( $audio ) && is_object( $audio ) ) {
$mime = str_replace( 'audio/', '', get_post_mime_type( $audio->ID ) );
if ( in_array( $mime, array( 'mp3', 'ogg', 'wav', ) ) )
$classes[] = $mime;
}
}
return $classes;
}
add_filter( 'post_class', 'pinktouch_post_classes' );
if ( ! function_exists( 'shortcode_exists' ) ) :
/**
* Shiv for shortcode_exists().
*
* shortcode_exists() was introduced to WordPress in version 3.6. To
* provide backward compatibility with previous versions, we will define our
* own version of this function.
*
* @todo Remove this function when WordPress 3.8 is released.
*
* @param string $name The name of the shortcode.
* @return bool True if shortcode exists; False otherwise.
*/
function shortcode_exists( $tag ) {
global $shortcode_tags;
return array_key_exists( $tag, $shortcode_tags );
}
endif;
if ( ! function_exists( 'pinktouch_the_attached_image' ) ) :
/**
* Prints the attached image with a link to the next attached image.
*/
function pinktouch_the_attached_image() {
$next_id = null;
$post = get_post();
$attachment_size = apply_filters( 'pinktouch_attachment_size', 510 );
$next_attachment_url = wp_get_attachment_url();
if ( $post->post_parent ) {
/**
* Grab the IDs of all the image attachments in a gallery so we can get the URL
* of the next adjacent image in a gallery, or the first image (if we're
* looking at the last image in a gallery), or, in a gallery of one, just the
* link to that image file.
*/
$attachment_ids = get_posts( array(
'post_parent' => $post->post_parent,
'fields' => 'ids',
'numberposts' => 999,
'post_status' => 'inherit',
'post_type' => 'attachment',
'post_mime_type' => 'image',
'order' => 'ASC',
'orderby' => 'menu_order ID'
) );
// If there is more than 1 attachment in a gallery...
if ( is_countable( $attachment_ids ) && count( $attachment_ids ) > 1 ) {
foreach ( $attachment_ids as $idx => $attachment_id ) {
if ( $attachment_id == $post->ID ) {
$next_id = $attachment_ids[ ( $idx + 1 ) % count( $attachment_ids ) ];
break;
}
}
// get the URL of the next image attachment...
if ( $next_id )
$next_attachment_url = get_attachment_link( $next_id );
// or get the URL of the first image attachment.
else
$next_attachment_url = get_attachment_link( array_shift( $attachment_ids ) );
}
}
printf( '%2$s',
esc_url( $next_attachment_url ),
wp_get_attachment_image( $post->ID, array( $attachment_size, 510 ) )
);
}
endif;
/**
* Deprecated.
*
* This function is kept just in case it has
* been used in a child theme. It does nothing.
*
* @deprecated 1.2
*/
function pinktouch_add_audio_support() {
_deprecated_function( __FUNCTION__, '1.2' );
}
/**
* Filters wp_title to print a neat tag based on what is being viewed.
*
* @since Pink Touch 2 1.1
*/
function pinktouch_wp_title( $title, $sep ) {
global $page, $paged;
if ( is_feed() )
return $title;
// Add the blog name
$title .= get_bloginfo( 'name' );
// Add the blog description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) )
$title .= " $sep $site_description";
// Add a page number if necessary:
if ( $paged >= 2 || $page >= 2 )
$title .= " $sep " . sprintf( __( 'Page %s', 'pinktouch' ), max( $paged, $page ) );
return $title;
}
add_filter( 'wp_title', 'pinktouch_wp_title', 10, 2 );
if ( ! function_exists( 'pinktouch_audio_grabber' ) ) :
/**
* Return the first audio file found for a post.
*
* @param int post_id ID for parent post
* @return boolean|string Path to audio file
*/
function pinktouch_audio_grabber( $post_id ) {
global $wpdb;
$first_audio = $wpdb->get_var( $wpdb->prepare( "SELECT guid FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'attachment' AND INSTR(post_mime_type, 'audio') ORDER BY menu_order ASC LIMIT 0,1", (int) $post_id ) );
if ( ! empty( $first_audio ) )
return $first_audio;
return false;
}
endif;
/**
* Load Jetpack compatibility file.
*/
require get_template_directory() . '/inc/jetpack.compat.php';
// This theme was built with PHP, Semantic HTML, CSS, love, and a Toolbox.