/** * Get the_title() taking into account if it should * wrapped in a link. * * @since 2.3.0 * * @param int $post_id Can feed in a post ID if outside the loop. * @param bool $foce_link Whether to force the title to link. * @return string $title The title of the post */ function themeblvd_get_the_title($post_id = 0, $force_link = false) { $url = ''; $title = get_the_title($post_id); // If "link" post format, get URL from start of content. if (has_post_format('link', $post_id)) { $url = get_content_url(get_the_content($post_id)); } // If not a single post or page, get permalink for URL. if (!$url && (!themeblvd_was('single') || $force_link)) { $url = get_permalink($post_id); } // Wrap title in link if there's a URL. if ($url) { $title = sprintf('<a href="%s" title="%s">%s</a>', esc_url($url), esc_attr(the_title_attribute('echo=0')), $title); } return apply_filters('themeblvd_the_title', $title, $url); }
/** * Get thumbnail size based on passed in size and/or * framework options. * * @since 2.3.0 * * @param $size string Optional current size of image * @param $location string Optional location for thumbnail * @param $sidebar_layout string Optional current sidebar layout * @return $size Size after it's been formatted */ function themeblvd_get_thumbnail_size($size = '', $location = 'primary', $sidebar_layout = 'full_width') { // If no $size was passed in, we'll use the framework's options // to determine one for different scenarios. if (!$size) { if (themeblvd_was('home') || themeblvd_was('page_template', 'template_list.php')) { // "Primary Posts Display" (i.e. homepage or post list template) $size = themeblvd_get_option('blog_thumbs'); } else { if (themeblvd_was('search') || themeblvd_was('archive')) { // Search results and archives $size = themeblvd_get_option('archive_thumbs'); } else { if (themeblvd_was('single')) { // Single posts. First check for overrding meta value, then // move to default option from theme options page. $size_meta = get_post_meta(get_the_ID(), '_tb_thumb', true); if ($size_meta == 'full' || $size_meta == 'small' || $size_meta == 'hide') { $size = $size_meta; } else { $size = themeblvd_get_option('single_thumbs'); } } } } } if ($size == 'hide') { $size = null; } if ($size == 'full') { $location == 'featured' || $sidebar_layout == 'full_width' ? $size = 'tb_large' : ($size = 'tb_medium'); } if ($size == 'small') { $size = 'tb_small'; } return apply_filters('themeblvd_get_thumbnail_size', $size, $location, $sidebar_layout); }