/** * Echo post meta author shortcode. * * @since 1.0.0 */ function beans_post_meta_author_shortcode() { beans_output_e('beans_post_meta_author_prefix', __('By ', 'tm-beans')); beans_open_markup_e('beans_post_meta_author', 'a', array('href' => get_author_posts_url(get_the_author_meta('ID')), 'rel' => 'author', 'itemprop' => 'author', 'itemscope' => '', 'itemtype' => 'http://schema.org/Person')); beans_output_e('beans_post_meta_author_text', get_the_author()); beans_selfclose_markup_e('beans_post_meta_author_name_meta', 'meta', array('itemprop' => 'name', 'content' => get_the_author())); beans_close_markup_e('beans_post_meta_author', 'a'); }
/** * Echo post image. * * @since 1.0.0 */ function beans_post_image() { if (!has_post_thumbnail() || !current_theme_supports('post-thumbnails')) { return false; } global $post; /** * Filter whether Beans should handle the image edition (resize) or let WP do so. * * @since 1.2.5 * * @param bool $edit True to use Beans Image API to handle the image edition (resize), false to let {@link http://codex.wordpress.org/Function_Reference/the_post_thumbnail the_post_thumbnail()} taking care of it. Default true. */ $edit = apply_filters('beans_post_image_edit', true); if ($edit) { /** * Filter the arguments used by {@see beans_edit_image()} to edit the post image. * * @since 1.0.0 * * @param bool|array $edit_args Arguments used by {@see beans_edit_image()}. Set to false to use WordPress * large size. */ $edit_args = apply_filters('beans_edit_post_image_args', array('resize' => array(800, false))); if (empty($edit_args)) { $image = beans_get_post_attachment($post->ID, 'large'); } else { $image = beans_edit_post_attachment($post->ID, $edit_args); } /** * Filter the arguments used by {@see beans_edit_image()} to edit the post small image. * * The small image is only used for screens equal or smaller than the image width set, which is 480px by default. * * @since 1.0.0 * * @param bool|array $edit_args Arguments used by {@see beans_edit_image()}. Set to false to use WordPress * small size. */ $edit_small_args = apply_filters('beans_edit_post_image_small_args', array('resize' => array(480, false))); if (empty($edit_small_args)) { $image_small = beans_get_post_attachment($post->ID, 'thumbnail'); } else { $image_small = beans_edit_post_attachment($post->ID, $edit_small_args); } } beans_open_markup_e('beans_post_image', 'div', array('class' => 'tm-article-image')); if (!is_singular()) { beans_open_markup_e('beans_post_image_link', 'a', array('href' => get_permalink(), 'title' => the_title_attribute('echo=0'))); } beans_open_markup_e('beans_post_image_item_wrap', 'picture'); if ($edit) { beans_selfclose_markup_e('beans_post_image_small_item', 'source', array('media' => '(max-width: ' . $image_small->width . 'px)', 'srcset' => esc_url($image_small->src)), $image_small); beans_selfclose_markup_e('beans_post_image_item', 'img', array('width' => $image->width, 'height' => $image->height, 'src' => $image->src, 'alt' => $image->alt, 'itemprop' => 'image'), $image); } else { // Beans API isn't available, use wp_get_attachment_image_attributes filter instead. the_post_thumbnail(); } beans_close_markup_e('beans_post_image_item_wrap', 'picture'); if (!is_singular()) { beans_close_markup_e('beans_post_image_link', 'a'); } beans_close_markup_e('beans_post_image', 'div'); }
/** * Echo header site branding. * * @since 1.0.0 */ function beans_site_branding() { beans_open_markup_e('beans_site_branding', 'div', array('class' => 'tm-site-branding uk-float-left' . (!get_bloginfo('description') ? ' uk-margin-small-top' : null))); beans_open_markup_e('beans_site_title_link', 'a', array('href' => home_url(), 'rel' => 'home', 'itemprop' => 'headline')); if ($logo = get_theme_mod('beans_logo_image', false)) { beans_selfclose_markup_e('beans_logo_image', 'img', array('class' => 'tm-logo', 'src' => $logo, 'alt' => get_bloginfo('name'))); } else { beans_output_e('beans_site_title_text', get_bloginfo('name')); } beans_close_markup_e('beans_site_title_link', 'a'); beans_close_markup_e('beans_site_branding', 'div'); }
/** * Echo comment divider. * * @since 1.0.0 */ function beans_comment_form_divider() { beans_selfclose_markup_e('beans_comment_form_divider', 'hr', array('class' => 'uk-article-divider')); }