';
print_r( $param );
echo '';
}
/** Canyon Alpha Numeric Characters Only */
function canyon_alpha_num_chars ( $param = '' ) {
return preg_replace( '|[^a-zA-Z0-9]|', ' ', trim( $param ) );
}
/** Canyon Replace White Spaces */
function canyon_replace_white_spaces ( $param = '', $replace = '-' ) {
return preg_replace( '!\s+!', $replace, trim( $param ) );
}
/** Canyon Post Date */
function canyon_post_date() {
$post_date = esc_html( get_the_date() ) . " " . esc_attr( get_the_time() );
/** Output */
$output = sprintf( '%1$s', $post_date, esc_url( get_permalink() ), the_title_attribute( 'echo=0' ) );
return $output;
}
/** Canyon Post Author */
function canyon_post_author() {
$output = sprintf( ' / %2$s', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_html( get_the_author() ) );
return $output;
}
/** Canyon Post Edit Link */
function canyon_post_edit_link() {
/** Manipulation */
ob_start();
if ( 'post' == get_post_type() ) :
edit_post_link( __( 'Edit', 'canyon' ), ' / ', '' );
else:
edit_post_link( __( 'Edit', 'canyon' ), '', '' );
endif;
$output = ob_get_clean();
return $output;
}
/** Canyon Post Comments */
function canyon_post_comments() {
if ( ( ! comments_open() || post_password_required() ) ) {
return;
}
ob_start();
comments_number( __( 'Leave a Comment', 'canyon' ), __( '1 Comment', 'canyon' ), __( '% Comments', 'canyon' ) );
$comments = ob_get_clean();
/** Output */
$comments = sprintf( '%s', esc_url( get_comments_link() ), $comments );
$output = sprintf( ' / ', $comments );
return $output;
}
/** Canyon Post Categories */
function canyon_post_category() {
$categories_list = get_the_category_list( ', ' );
if ( ! $categories_list ) {
return;
}
$output = sprintf( ''. __( 'Posted in:', 'canyon' ) .' %2$s', 'entry-utility-prep entry-utility-prep-cat-links', $categories_list );
return $output;
}
/** Canyon Post Tags */
function canyon_post_tags() {
$tags_list = get_the_tag_list( '', ', ' );
if ( ! $tags_list ) {
return;
}
$output = sprintf( ' / '. __( 'Tagged:', 'canyon' ) .' %2$s', 'entry-utility-prep entry-utility-prep-tag-links', $tags_list );
return $output;
}
/** Canyon Link Pages */
function canyon_link_pages() {
return wp_link_pages( array(
'before' => '
'. __( 'Pages:', 'canyon' ) .'',
'after' => '
',
'link_before' => '',
'link_after' => '',
'echo' => 0
)
);
}
/** Canyon Post Style */
function canyon_post_style() {
$canyon_options = canyon_get_settings();
if( $canyon_options['canyon_post_style'] == 'excerpt' ):
the_excerpt();
else:
the_content( __( 'Read More', 'canyon' ) . ' →' );
endif;
}
/** Canyon Featured Image */
function canyon_featured_image() {
$canyon_options = canyon_get_settings();
if( $canyon_options['canyon_post_style'] != 'excerpt' ):
return;
endif;
$img = canyon_get_image( array( 'format' => 'html', 'size' => 'featured', 'attr' => array( 'class' => 'entry-image' ) ) );
printf( '', esc_url( get_permalink() ), the_title_attribute( 'echo=0' ), $img );
}
/** Canyon Loop Navigation */
function canyon_loop_nav() {
global $wp_query;
if ( $wp_query->max_num_pages > 1 ) :
$canyon_options = canyon_get_settings();
if ( $canyon_options['canyon_post_nav_style'] == 'numeric' ) :
canyon_loop_nav_numeric();
else:
canyon_loop_nav_next_prev();
endif;
endif;
}
/** Canyon Loop Navigation Numeric */
function canyon_loop_nav_numeric() {
global $wp_query;
$big = 999999999; // Need an unlikely integer
$args = array(
'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages
);
?>
← '. __( 'Older Posts', 'canyon' ) );
$next_posts_link = ob_get_clean();
ob_start();
previous_posts_link( __( 'Newer Posts', 'canyon' ) .' →' );
$previous_posts_link = ob_get_clean();
$next_posts_link = ( empty( $next_posts_link ) )? ' ' : $next_posts_link;
$previous_posts_link = ( empty( $previous_posts_link ) )? ' ' : $previous_posts_link;
?>
← '. __( 'Return to entry', 'canyon' ) );
$previous_post_link = ob_get_clean();
if( !empty( $previous_post_link ) ):
echo '
' . $previous_post_link . '
';
endif;
?>
← '. __( 'Previous Post', 'canyon' ) );
$previous_post_link = ob_get_clean();
ob_start();
next_post_link( '%link', __( 'Next Post', 'canyon' ) . ' →' );
$next_post_link = ob_get_clean();
$previous_post_link = ( empty( $previous_post_link ) )? ' ' : $previous_post_link;
$next_post_link = ( empty( $next_post_link ) )? ' ' : $next_post_link;
?>
comment_type ) {
case 'pingback':
case 'trackback':
?>
', '' ); ?>
id="li-comment-">
comment_type )
}
/** Sets the post excerpt length. */
add_filter( 'excerpt_length', 'canyon_excerpt_length' );
function canyon_excerpt_length( $length ) {
return 50;
}
/** Returns a "Read more" link for content */
add_filter( 'the_content_more_link', 'canyon_content_more_link', 10, 2 );
function canyon_content_more_link( $more_link, $more_link_text ) {
return str_replace( $more_link_text, ''. __( 'Read more →', 'canyon' ) .'', $more_link );
}
/** Returns a "Read more" link for excerpts */
function canyon_continue_reading_link() {
return ''. __( 'Read more →', 'canyon' ) .'
';
}
/** Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and canyon_continue_reading_link(). */
add_filter( 'excerpt_more', 'canyon_auto_excerpt_more' );
function canyon_auto_excerpt_more( $more ) {
return ' …' . canyon_continue_reading_link();
}
/** Adds a pretty "Read more" link to custom post excerpts. */
add_filter( 'get_the_excerpt', 'canyon_custom_excerpt_more' );
function canyon_custom_excerpt_more( $output ) {
if ( has_excerpt() && ! is_attachment() ) {
$output .= ' …' . canyon_continue_reading_link();
}
return $output;
}
/** Remove WP Gallery CSS */
add_filter( 'gallery_style', 'canyon_remove_gallery_css' );
function canyon_remove_gallery_css( $css ) {
return preg_replace( "##s", '', $css );
}
?>