for post and comments.
add_theme_support('automatic-feed-links');
// This theme does support custom background color.
add_theme_support('custom-background', array(
'default-color' => 'cccccc',
));
// Enable Featured Image
add_theme_support('post-thumbnails');
add_image_size('small-thumbnail', 150, 150, true);
add_image_size('medium-thumbnail', 650, 150, true);
add_image_size('large-thumbnail', 900, 200, true);
}
add_action('after_setup_theme', 'azulsilver_theme_setup');
}
// Add Support for Custom Header Image.
require(get_template_directory() . '/page-templates/custom-header.php');
//Register Post Sidebar, Page Sidebar, and Custom Sidebar
function azulsilver_widget_sidebar_setup(){
//Register Sidebar for Post Only
register_sidebar(array(
'name' => __('Primary Sidebar', 'azulsilver'),
'id' => 'post-content',
'description' => ('Appear on Post Contents Only'),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
'after_title' => '
',
));
//Register Sidebar for Page Only
register_sidebar(array(
'name' => __('Secondary Sidebar', 'azulsilver'),
'id' => 'page-content',
'description' => ('Appear on Pages Only'),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
'after_title' => '
',
));
//Register Sidebar for Page Only
register_sidebar(array(
'name' => __('Custom Sidebar', 'azulsilver'),
'id' => 'custom-content',
'description' => ('Appear on Custom Pages Only'),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
'after_title' => '
',
));
}
add_action('widgets_init', 'azulsilver_widget_sidebar_setup');
function azulsilver_metadata_posted_on_setup(){
// This function will call and output The Date and Author
printf( __( ' %2$s %3$s', 'azulsilver' ), 'meta-prep meta-prep-author',
sprintf( '%3$s',
get_permalink(),
esc_attr( get_the_time() ),
get_the_date('m/d/Y')),
sprintf( '%3$s',
get_author_posts_url( get_the_author_meta( 'ID' ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'azulsilver' ), get_the_author() ) ),
get_the_author()
));
// This function will only display when sticky post is enabled!
if (is_sticky()){
echo ' Sticky Post';
}
if (has_post_thumbnail()){
echo' Featured Image';
}
// This function will call and output Comments
printf(' ');
if (comments_open()) {
comments_popup_link('Add Comment','1 Comment','% Comments');
}
else {
_e('Comments Closed', 'azulsilver');
}
}
function azulsilver_metadata_posted_in_setup() {
// Retrieves tag list of current post, separated by commas.
$tag_list = get_the_tag_list( '', ', ' );
if ( $tag_list ) {
$posted_in = __( ' %1$s %2$s', 'azulsilver' );
} elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) {
$posted_in = __( ' %1$s', 'azulsilver' );
}
// Prints the string, replacing the placeholders.
printf(
$posted_in,
get_the_category_list( ', ' ),
$tag_list,
get_permalink(),
the_title_attribute( 'echo=0' )
);
}
function azulsilver_paging_navigation() {
// Don't print empty markup if there's only one page.
if ( $GLOBALS['wp_query']->max_num_pages < 2 ) {
return;
}
$paged = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
$pagenum_link = html_entity_decode( get_pagenum_link() );
$query_args = array();
$url_parts = explode( '?', $pagenum_link );
if ( isset( $url_parts[1] ) ) {
wp_parse_str( $url_parts[1], $query_args );
}
$pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link );
$pagenum_link = trailingslashit( $pagenum_link ) . '%_%';
$format = $GLOBALS['wp_rewrite']->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : '';
$format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit( 'page/%#%', 'paged' ) : '?paged=%#%';
// Set up paginated links.
$links = paginate_links( array(
'base' => $pagenum_link,
'format' => $format,
'total' => $GLOBALS['wp_query']->max_num_pages,
'current' => $paged,
'mid_size' => 2,
'add_args' => array_map( 'urlencode', $query_args ),
'prev_text' => __( 'Previous', 'azulsilver' ),
'next_text' => __( 'Next', 'azulsilver' ),
'type' => 'list',
) );
if ( $links ) :
?>