ID, '_pridmag_layout_meta', true );
if ( empty( $pridmag_post_specific_layout ) || $pridmag_post_specific_layout == 'th-default-layout' ) {
$classes[] = esc_attr( get_theme_mod( 'pridmag_post_sidebar_align', 'th-right-sidebar' ) );
} else {
$classes[] = esc_attr( $pridmag_post_specific_layout );
}
}
if ( is_page() ) {
$page_specific_layout = get_post_meta( $post->ID, '_pridmag_layout_meta', true );
if ( empty( $page_specific_layout ) || $page_specific_layout == 'th-default-layout' ) {
$classes[] = esc_attr( get_theme_mod( 'pridmag_page_sidebar_align', 'th-right-sidebar' ) );
} else {
$classes[] = esc_attr( $page_specific_layout );
}
}
return $classes;
}
add_filter( 'body_class', 'pridmag_body_classes' );
/**
* Add a pingback url auto-discovery header for single posts, pages, or attachments.
*/
function pridmag_pingback_header() {
if ( is_singular() && pings_open() ) {
echo '';
}
}
add_action( 'wp_head', 'pridmag_pingback_header' );
/**
* Add a custom excerpt length.
*/
function pridmag_excerpt_length( $length ) {
if( is_admin() ) {
return $length;
}
$custom_length = get_theme_mod( 'pridmag_excerpt_length', 20 );
return absint( $custom_length );
}
add_filter( 'excerpt_length', 'pridmag_excerpt_length', 999 );
/**
* Changes the excerpt more text.
*/
function pridmag_excerpt_more( $more ) {
if ( is_admin() ) {
return $more;
}
return ' … ';
}
add_filter( 'excerpt_more', 'pridmag_excerpt_more' );
/**
* View all link for posts widgets
*/
function pridmag_viewall_link( $category_id, $viewall_text ) {
if ( ! empty( $viewall_text ) ) :
if ( ! empty( $category_id ) ) {
$viewall_link = get_category_link( $category_id );
} else {
$posts_page_id = get_option( 'page_for_posts' );
if ( $posts_page_id ) {
$viewall_link = get_page_link( $posts_page_id );
} else {
$viewall_link = "";
}
}
if ( $viewall_link ) { ?>
ID, '_pridmag_layout_meta', true );
if ( empty( $pridmag_post_specific_layout ) || $pridmag_post_specific_layout == 'th-default-layout' ) {
$layout = get_theme_mod( 'pridmag_post_sidebar_align', 'th-right-sidebar' );
} else {
$layout = $pridmag_post_specific_layout;
}
}
if( is_page() ) {
$pridmag_page_specific_layout = get_post_meta( $post->ID, '_pridmag_layout_meta', true );
if ( empty( $pridmag_page_specific_layout ) || $pridmag_page_specific_layout == 'th-default-layout' ) {
$layout = get_theme_mod( 'pridmag_page_sidebar_align', 'th-right-sidebar' );
} else {
$layout = $pridmag_page_specific_layout;
}
}
return $layout;
}
endif;