function twentysixteen_entry_meta() { ob_start(); if ('post' === get_post_type()) { ob_start(); twentysixteen_entry_date(); $postedOn = ob_get_clean(); $author_avatar_size = apply_filters('twentysixteen_author_avatar_size', 49); printf('<div class="name-date"><div class="name"><span class="screen-reader-text">%2$s </span> <a class="url fn n" href="%3$s">%4$s</a></div><div class="date">%5$s</div></div><div class="avatar">%1$s</div>', get_avatar(get_the_author_meta('user_email'), $author_avatar_size), _x('Author', 'Used before post author name.', 'twentysixteen'), esc_url(get_author_posts_url(get_the_author_meta('ID'))), get_the_author(), $postedOn); } if (in_array(get_post_type(), array('attachment'))) { twentysixteen_entry_date(); } $authordate = ob_get_clean(); printf('<div class="author-date">%s</div>', $authordate); $format = get_post_format(); if (current_theme_supports('post-formats', $format)) { printf('<span class="entry-format">%1$s<a href="%2$s">%3$s</a></span>', sprintf('<span class="screen-reader-text">%s </span>', _x('Format', 'Used before post format.', 'twentysixteen')), esc_url(get_post_format_link($format)), get_post_format_string($format)); } echo '<div class="taxonomies">'; if ('post' === get_post_type()) { twentysixteen_entry_taxonomies(); } echo '</div>'; if (!is_singular() && !post_password_required() && (comments_open() || get_comments_number())) { echo '<span class="comments-link">'; comments_popup_link(sprintf(__('Leave a comment<span class="screen-reader-text"> on %s</span>', 'twentysixteen'), get_the_title())); echo '</span>'; } }
/** * @see CPAC_Column::get_value() * @since 2.0 */ function get_value($post_id) { if (!($format = $this->get_raw_value($post_id))) { return false; } return esc_html(get_post_format_string($format)); }
function warrior_archive_title() { global $wp_query; $title = ''; if (is_category()) { $title = sprintf(__('%s <span>Category Archives</span>', 'familia'), single_cat_title('', false)); } elseif (is_tag()) { $title = sprintf(__('%s <span>Tag Archives</span>', 'familia'), single_tag_title('', false)); } elseif (get_post_format()) { $title = sprintf(__('Post Format: %s', 'familia'), get_post_format_string(get_post_format())); } elseif (is_day()) { $title = sprintf(__('%s <span>Daily Archives</span>', 'familia'), date_i18n('d', strtotime(get_the_date('Y-m-d'), false))); } elseif (is_month()) { $title = sprintf(__('%s <span>Monthly Archives</span>', 'familia'), date_i18n('F', strtotime(get_the_date('Y-m-d'), false))); } elseif (is_year()) { $title = sprintf(__('%s <span>Yearly Archives</span>', 'familia'), date_i18n('F', strtotime(get_the_date('Y-m-d'), false))); } elseif (is_author()) { $author = get_user_by('slug', get_query_var('author_name')); $title = sprintf(__('%s <span>Author Archives</span>', 'familia'), get_the_author_meta('display_name', $author->ID)); } elseif (is_search()) { if ($wp_query->found_posts) { $title = sprintf(__('Search Results for: "%s"', 'familia'), esc_attr(get_search_query())); } else { $title = sprintf(__('No Results for: "%s"', 'familia'), esc_attr(get_search_query())); } } elseif (is_404()) { $title = __('Not Found', 'familia'); } elseif (is_home() || is_front_page() || is_single()) { $title = ''; } else { $title = __('Blog', 'familia'); } return $title; }
function directory_theme_entry_meta() { if (is_sticky() && is_home() && !is_paged()) { printf('<span class="sticky-post">%s</span>', __('Featured', 'directory-starter')); } $format = get_post_format(); if (current_theme_supports('post-formats', $format)) { printf('<span class="entry-format">%1$s<a href="%2$s">%3$s</a></span>', sprintf('<span class="screen-reader-text">%s </span>', _x('Format', 'Used before post format.', 'directory-starter')), esc_url(get_post_format_link($format)), get_post_format_string($format)); } if (in_array(get_post_type(), array('post', 'attachment'))) { $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>'; $time_string = sprintf($time_string, esc_attr(get_the_date('c')), get_the_date(), esc_attr(get_the_modified_date('c')), get_the_modified_date()); printf('<span class="posted-on"><span class="screen-reader-text">%1$s </span><a href="%2$s" rel="bookmark">%3$s</a></span>', _x('Posted on', 'Used before publish date.', 'directory-starter'), esc_url(get_permalink()), $time_string); } if ('post' == get_post_type()) { if (is_singular() || is_multi_author()) { printf('<span class="byline"><span class="author vcard"><span class="screen-reader-text">%1$s </span><a class="url fn n" href="%2$s">%3$s</a></span></span>', _x('Author', 'Used before post author name.', 'directory-starter'), esc_url(get_author_posts_url(get_the_author_meta('ID'))), get_the_author()); } $categories_list = get_the_category_list(_x(', ', 'Used between list items, there is a space after the comma.', 'directory-starter')); if ($categories_list) { printf('<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', _x('Categories', 'Used before category names.', 'directory-starter'), $categories_list); } $tags_list = get_the_tag_list('', _x(', ', 'Used between list items, there is a space after the comma.', 'directory-starter')); if ($tags_list) { printf('<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', _x('Tags', 'Used before tag names.', 'directory-starter'), $tags_list); } } if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) { echo '<span class="comments-link">'; comments_popup_link(__('Leave a comment', 'directory-starter'), __('1 Comment', 'directory-starter'), __('% Comments', 'directory-starter')); echo '</span>'; } }
function entry_date($echo = true) { $format_prefix = '%2$s'; $date = sprintf('<time class="date updated" role="update" datetime="%1$s">%2$s</time>', esc_attr(get_the_date('c')), esc_html(sprintf($format_prefix, get_post_format_string(get_post_format()), get_the_date()))); if ($echo) { echo $date; } return $date; }
function apostrophe_post_format() { $format = get_post_format(); $formats = get_theme_support('post-formats'); // If the post has no format, or if it's not a format supported by the theme, return early if (!$format || !has_post_format($formats[0])) { return; } printf('<a class="entry-format format-%1$s" href="%2$s" title="%3$s"><span class="screen-reader-text">%1$s</span></a>', esc_html(strtolower(get_post_format_string($format))), esc_url(get_post_format_link($format)), sprintf(esc_html('All %s posts', 'apostrophe'), esc_html(get_post_format_string($format)))); }
function enlightenment_post_formats() { $formats = get_theme_support('post-formats'); $post_formats = array(); foreach ($formats[0] as $format) { $post_formats[$format] = get_post_format_string($format); if (current_theme_supports('enlightenment-grid-loop')) { $post_formats[$format . '-teaser'] = get_post_format_string($format) . ' Teaser'; } } return apply_filters('enlightenment_post_formats', $post_formats); }
/** * Prints HTML with meta information for the categories, tags. * * @since Twenty Fifteen 1.0 */ function twentyfifteen_entry_meta() { if (is_sticky() && is_home() && !is_paged()) { printf('<span class="sticky-post">%s</span>', __('Featured', 'twentyfifteen')); } $format = get_post_format(); if (current_theme_supports('post-formats', $format)) { printf('<span class="entry-format">%1$s<a href="%2$s">%3$s</a></span>', sprintf('<span class="screen-reader-text">%s </span>', _x('Format', 'Used before post format.', 'twentyfifteen')), esc_url(get_post_format_link($format)), get_post_format_string($format)); } if (in_array(get_post_type(), array('post', 'attachment'))) { $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>'; if (get_the_time('U') !== get_the_modified_time('U')) { $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>'; } $time_string = sprintf($time_string, esc_attr(get_the_date('D')), get_the_date(), esc_attr(get_the_modified_date('c')), get_the_modified_date()); printf('<li class="icon fa-calendar posted-on"><span class="screen-reader-text">%1$s </span><a href="%2$s" rel="bookmark">%3$s</a></li>', _x('', 'Used before publish date.', 'twentyfifteen'), esc_url(get_permalink()), get_the_date('d/M')); } if ('post' == get_post_type()) { if (is_singular() || is_multi_author()) { // printf( '<span class="byline"><span class="author vcard"><span class="screen-reader-text">%1$s </span><a class="url fn n" href="%2$s">%3$s</a></span></span>', // _x( 'Author', 'Used before post author name.', 'twentyfifteen' ), // esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), // get_the_author() // ); } $categories_list = get_the_category_list(_x(', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen')); if ($categories_list && twentyfifteen_categorized_blog()) { printf('<li class="cat-links icon fa fa-clone"><span class="screen-reader-text">%1$s </span>%2$s</li>', _x('Categories', 'Used before category names.', 'twentyfifteen'), $categories_list); } $tags_list = get_the_tag_list('', _x(', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen')); if ($tags_list) { printf('<li class="tags-links icon fa-tags"><span class="screen-reader-text">%1$s </span>%2$s</li>', _x('', 'Used before tag names.', 'twentyfifteen'), $tags_list); } } if (is_attachment() && wp_attachment_is_image()) { // Retrieve attachment metadata. $metadata = wp_get_attachment_metadata(); printf('<span class="full-size-link"><span class="screen-reader-text">%1$s </span><a href="%2$s">%3$s × %4$s</a></span>', _x('Full size', 'Used before full size attachment link.', 'twentyfifteen'), esc_url(wp_get_attachment_url()), $metadata['width'], $metadata['height']); } if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) { echo '<li class="icon fa-comment">'; /* translators: %s: post title */ echo get_comments_number(); echo '</li>'; /* translators: %s: post title */ // $categories = get_categories(); // foreach ($categories as $key => $category) { // echo '<li class="icon fa-clone">'; // echo $category->name; // echo '</li>'; // } } }
function mr_tailor_post_header_entry_date($echo = true) { if (has_post_format(array('chat', 'status'))) { $format_prefix = _x('%1$s on %2$s', '1: post format name. 2: date', 'mr_tailor'); } else { $format_prefix = '%2$s'; } $date = sprintf('<a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a>', esc_url(get_permalink()), esc_attr(sprintf(__('Permalink to %s', 'mr_tailor'), the_title_attribute('echo=0'))), esc_attr(get_the_date('c')), esc_html(sprintf($format_prefix, get_post_format_string(get_post_format()), get_the_date()))); if ($echo) { echo $date; } return $date; }
protected function getInput() { $html = array(); // Initialize some field attributes. $class = !empty($this->class) ? ' class="radio ' . $this->class . '"' : ' class="radio"'; $required = $this->required ? ' required aria-required="true"' : ''; $autofocus = $this->autofocus ? ' autofocus' : ''; $disabled = $this->disabled ? ' disabled' : ''; $readonly = $this->readonly; // Start the radio field output. $html[] = '<div id="' . $this->id . '"' . $class . $required . $autofocus . $disabled . ' >'; $options = array(); $options[] = 0; $post_formats = get_theme_support('post-formats'); if ($post_formats == false) { return null; } foreach ($post_formats[0] as $format) { $options[] = $format; } // Build the radio field output. foreach ($options as $i => $option) { // Initialize some option attributes. $checked = (string) $option == (string) $this->value ? ' checked="checked"' : ''; $class = !empty($option->class) ? ' class="' . $option->class . '"' : ''; if (0 === $option) { $class_label = 'class="post-format-icon post-format-standard"'; } else { $class_label = 'class = "post-format-icon post-format-' . esc_attr($option) . '"'; } $disabled = !empty($option->disable) || $readonly && !$checked; $disabled = $disabled ? ' disabled' : ''; // Initialize some JavaScript option attributes. $onclick = !empty($option->onclick) ? ' onclick="' . $option->onclick . '"' : ''; $onchange = !empty($option->onchange) ? ' onchange="' . $option->onchange . '"' : ''; $html[] = '<label style="display:block;">'; $html[] = '<input type="radio" id="' . $this->id . $i . '" name="' . $this->name . '" value="' . htmlspecialchars($option, ENT_COMPAT, 'UTF-8') . '"' . $checked . $class . $required . $onclick . $onchange . $disabled . ' />'; // $html[] = '<label for="' . $this->id . $i . '"' . $class_label . ' >' // . esc_html( get_post_format_string( $option ) ) . '</label>'; $html[] = '<i ' . $class_label . '></i>'; $html[] = esc_html(get_post_format_string($option)); $html[] = '</label>'; $required = ''; } // End the radio field output. $html[] = '</fieldset>'; return implode($html) . '</div><div><span class="help-block">' . $this->description . '</span>'; }
/** * Prints HTML with meta information for the categories, tags. * * @since Twenty Fifteen 1.0 */ function twentyfifteen_entry_meta() { if (is_sticky() && is_home() && !is_paged()) { printf('<span class="sticky-post">%s</span>', __('Featured', 'twentyfifteen')); } $format = get_post_format(); if (current_theme_supports('post-formats', $format)) { printf('<span class="entry-format">%1$s<a href="%2$s">%3$s</a></span>', sprintf('<span class="screen-reader-text">%s </span>', _x('Format', 'Used before post format.', 'twentyfifteen')), esc_url(get_post_format_link($format)), get_post_format_string($format)); } if (in_array(get_post_type(), array('post', 'attachment'))) { $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>'; if (get_the_time('U') !== get_the_modified_time('U')) { $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>'; } $time_string = sprintf($time_string, esc_attr(get_the_date('c')), get_the_date(), esc_attr(get_the_modified_date('c')), get_the_modified_date()); printf('<span class="posted-on"><span class="screen-reader-text">%1$s </span><a href="%2$s" rel="bookmark">%3$s</a></span>', _x('Posted on', 'Used before publish date.', 'twentyfifteen'), esc_url(get_permalink()), $time_string); } if ('post' == get_post_type()) { if (is_singular() || is_multi_author()) { printf('<span class="byline"><span class="author vcard"><span class="screen-reader-text">%1$s </span><a class="url fn n" href="%2$s">%3$s</a></span></span>', _x('Author', 'Used before post author name.', 'twentyfifteen'), esc_url(get_author_posts_url(get_the_author_meta('ID'))), get_the_author()); } $categories_list = get_the_category_list(_x(', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen')); if ($categories_list && twentyfifteen_categorized_blog()) { printf('<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', _x('Categories', 'Used before category names.', 'twentyfifteen'), $categories_list); } $tags_list = get_the_tag_list('', _x(', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen')); if ($tags_list) { printf('<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', _x('Tags', 'Used before tag names.', 'twentyfifteen'), $tags_list); } } if (is_attachment() && wp_attachment_is_image()) { // Retrieve attachment metadata. $metadata = wp_get_attachment_metadata(); printf('<span class="full-size-link"><span class="screen-reader-text">%1$s </span><a href="%2$s">%3$s × %4$s</a></span>', _x('Full size', 'Used before full size attachment link.', 'twentyfifteen'), esc_url(wp_get_attachment_url()), $metadata['width'], $metadata['height']); } $_number_roman = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); $_number_tibet = array('༠', '༡', '༢', '༣', '༤', '༥', '༦', '༧', '༨', '༩'); $_number = get_comments_number(); $new_number = str_replace($_number_roman, $_number_tibet, $_number); //echo $new_number; if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) { echo '<span class="comments-link">'; comments_popup_link(__('Leave a comment', 'twentyfifteen'), __('1 Comment', 'twentyfifteen'), __('% Comments', 'twentyfifteen')); echo '</span>'; } }
function twentysixteen_entry_meta() { if (in_array(get_post_type(), array('post', 'attachment'))) { twentysixteen_entry_date(); } $format = get_post_format(); if (current_theme_supports('post-formats', $format)) { printf('<span class="entry-format">%1$s<a href="%2$s">%3$s</a></span>', sprintf('<span class="screen-reader-text">%s </span>', _x('Format', 'Used before post format.', 'twentysixteen')), esc_url(get_post_format_link($format)), get_post_format_string($format)); } if ('post' === get_post_type()) { twentysixteen_entry_taxonomies(); } if (!is_singular() && !post_password_required() && (comments_open() || get_comments_number())) { echo '<span class="comments-link">'; comments_popup_link(sprintf(__('Leave a comment<span class="screen-reader-text"> on %s</span>', 'twentysixteen'), get_the_title())); echo '</span>'; } }
function ubik_meta_type($link = true) { // Exit early if we're not in the loop if (!in_the_loop()) { return; } // This sets a default type that can be overridden later $type = apply_filters('ubik_meta_type_default', __('Post', 'ubik')); // Content type if (is_attachment()) { if (wp_attachment_is_image()) { $type = __('Image', 'ubik'); } else { $type = __('Attachment', 'ubik'); } } elseif (is_page()) { $type = __('Page', 'ubik'); } // Post format voodoo $post_format = get_post_format(); if (!empty($post_format)) { $type = apply_filters('ubik_meta_post_format', get_post_format_string($post_format)); if ($link === true) { $type = '<a href="' . esc_url(get_post_format_link($post_format)) . '">' . $type . '</a>'; } } // Post type voodoo; get all post types that aren't built-in and cycle through to see if we have a match $post_types = get_post_types(array('public' => true, '_builtin' => false), 'objects'); if (!empty($post_types)) { foreach ($post_types as $post_type) { if ($post_type->name === get_post_type()) { if ($post_type->has_archive && $link === true) { $type = sprintf('<a href="%1$s">%2$s</a>', esc_url(get_post_type_archive_link($post_type->name)), $post_type->labels->singular_name); } else { $type = $post_type->labels->singular_name; } } } } // Return whatever we have found return apply_filters('ubik_meta_type', $type); }
/** * Prints HTML with meta information for the categories, tags. * * @since Twenty Fifteen 1.0 */ function launchpad_entry_meta() { if (is_sticky() && is_home() && !is_paged()) { printf('<span class="sticky-post">%s</span>', __('Featured', 'lifterlms-launchpad')); } $format = get_post_format(); if (current_theme_supports('post-formats', $format)) { printf('<span class="entry-format">%1$s<a href="%2$s">%3$s</a></span>', sprintf('<span class="meta-label">%s </span>', _x('Format', 'Used before post format.', 'lifterlmns-launchpad')), esc_url(get_post_format_link($format)), get_post_format_string($format)); } if (in_array(get_post_type(), array('post', 'attachment'))) { $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>'; // if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { // $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>'; // } $time_string = sprintf($time_string, esc_attr(get_the_date('c')), get_the_date(), esc_attr(get_the_modified_date('c')), get_the_modified_date()); printf('<span class="posted-on"><span class="meta-label">%1$s </span><a href="%2$s" rel="bookmark">%3$s</a></span>', _x('Posted on', 'Used before publish date.', 'lifterlms-launchpad'), esc_url(get_permalink()), $time_string); } if ('post' == get_post_type()) { if (is_singular() || is_multi_author()) { printf('<span class="byline"><span class="author vcard"><span class="meta-label">%1$s </span><a class="url fn n" href="%2$s">%3$s</a></span></span>', _x('Author', 'Used before post author name.', 'lifterlms-launchpad'), esc_url(get_author_posts_url(get_the_author_meta('ID'))), get_the_author()); } $categories_list = get_the_category_list(_x(', ', 'Used between list items, there is a space after the comma.', 'lifterlms-launchpad')); if ($categories_list && launchpad_categorized_blog()) { printf('<span class="cat-links"><span class="meta-label">%1$s </span>%2$s</span>', _x('Categories', 'Used before category names.', 'lifterlms-launchpad'), $categories_list); } $tags_list = get_the_tag_list('', _x(', ', 'Used between list items, there is a space after the comma.', 'lifterlms-launchpad')); if ($tags_list) { printf('<span class="tags-links"><span class="meta-label">%1$s </span>%2$s</span>', _x('Tags', 'Used before tag names.', 'lifterlms-launchpad'), $tags_list); } } if (is_attachment() && wp_attachment_is_image()) { // Retrieve attachment metadata. $metadata = wp_get_attachment_metadata(); printf('<span class="full-size-link"><span class="meta-label">%1$s </span><a href="%2$s">%3$s × %4$s</a></span>', _x('Full size', 'Used before full size attachment link.', 'lifterlms-launchpad'), esc_url(wp_get_attachment_url()), $metadata['width'], $metadata['height']); } if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) { echo '<span class="comments-link">'; /* translators: %s: post title */ comments_popup_link(sprintf(__('Leave a comment<span class="meta-label"> on %s</span>', 'lifterlms-launchpad'), get_the_title())); echo '</span>'; } }
/** * Prints HTML with meta information for the categories, tags. * * Create your own wp_futurelab_entry_meta() function to override in a child theme. * */ function wp_futurelab_entry_meta() { if ('post' === get_post_type()) { $author_avatar_size = apply_filters('wp_futurelab_author_avatar_size', 49); printf('<span class="byline"><span class="author vcard">%1$s<span class="screen-reader-text">%2$s </span> <a class="url fn n" href="%3$s">%4$s</a></span></span>', get_avatar(get_the_author_meta('user_email'), $author_avatar_size), _x('Author', 'Used before post author name.', 'wp_futurelab'), esc_url(get_author_posts_url(get_the_author_meta('ID'))), get_the_author()); } if (in_array(get_post_type(), array('post', 'attachment'))) { wp_futurelab_entry_date(); } $format = get_post_format(); if (current_theme_supports('post-formats', $format)) { printf('<span class="entry-format">%1$s<a href="%2$s">%3$s</a></span>', sprintf('<span class="screen-reader-text">%s </span>', _x('Format', 'Used before post format.', 'wp_futurelab')), esc_url(get_post_format_link($format)), get_post_format_string($format)); } if ('post' === get_post_type()) { wp_futurelab_entry_taxonomies(); } if (!is_singular() && !post_password_required() && (comments_open() || get_comments_number())) { echo '<span class="comments-link">'; comments_popup_link(sprintf(__('Leave a comment<span class="screen-reader-text"> on %s</span>', 'wp_futurelab'), get_the_title())); echo '</span>'; } }
function homeroom_post_formats_select($checks = true, $all_label = false) { if ($checks) { if (!current_theme_supports('post-formats')) { return; } if ('post' !== get_current_screen()->post_type) { return; } } $all_label = !$all_label ? __('All Formats', 'homeroom') : $all_label; $post_formats = get_theme_support('post-formats'); if (is_array($post_formats[0])) { ?> <select name="post_format" id="post_format"> <option value="0"><?php _e($all_label, 'homeroom'); ?> </option> <?php foreach ($post_formats[0] as $format) { ?> <option<?php selected(isset($_REQUEST['post_format']) && $_REQUEST['post_format'] == $format); ?> value="<?php echo esc_attr($format); ?> "><?php echo esc_html(get_post_format_string($format)); ?> </option> <?php } ?> </select><?php } }
function pf_post_admin_setup() { if (!empty($this->post_formats[0]) && is_array($this->post_formats[0])) { global $post; // See if we're specifying custom post formats for this post type /****************************************************************************************************** * This can be achieved by setting some extra data in add_post_type_support so we can test for it here * and if it's found we know to have listed tabs modified to suit this case. * * Example: add_post_type_support( $post_type, 'post-formats', array( 'gallery', 'image', 'video' ) ); * * Based on the following resource: * http://wordpress.stackexchange.com/questions/16136/different-post-format-options-per-custom-post-type * */ if (is_array($GLOBALS['_wp_post_type_features'][$post->post_type]['post-formats'])) { // This gets the custom Post Type specific list $this->post_formats = $GLOBALS['_wp_post_type_features'][$post->post_type]['post-formats']; } $current_post_format = get_post_format($post->ID); // support the possibility of people having hacked in custom // post-formats or that this theme doesn't natively support // the post-format in the current post - a tab will be added // for this format but the default WP post UI will be shown ~sp if (!empty($current_post_format) && !in_array($current_post_format, $this->post_formats[0])) { array_push($this->post_formats[0], get_post_format_string($current_post_format)); } array_unshift($this->post_formats[0], 'standard'); $this->post_formats = $this->post_formats[0]; include 'views/tabs.php'; $format_views = array('link', 'quote', 'video', 'gallery', 'audio'); foreach ($format_views as $format) { if (in_array($format, $this->post_formats)) { include 'views/format-' . $format . '.php'; } } } }
function twentyfifteen_child_entry_meta() { if (is_sticky() && is_home() && !is_paged()) { printf('<span class="sticky-post">%s</span>', __('Featured', 'twentyfifteen')); } $format = get_post_format(); if (current_theme_supports('post-formats', $format)) { printf('<span class="entry-format">%1$s<a href="%2$s">%3$s</a></span>', sprintf('<span class="screen-reader-text">%s </span>', _x('Format', 'Used before post format.', 'twentyfifteen')), esc_url(get_post_format_link($format)), get_post_format_string($format)); } if (in_array(get_post_type(), array('post', 'attachment'))) { $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>'; if (get_the_time('U') !== get_the_modified_time('U')) { $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>'; } $time_string = sprintf($time_string, esc_attr(get_the_date('c')), get_the_date(), esc_attr(get_the_modified_date('c')), get_the_modified_date()); printf('<span class="posted-on"><span class="screen-reader-text">%1$s </span><a href="%2$s" rel="bookmark">%3$s</a></span>', _x('Posted on', 'Used before publish date.', 'twentyfifteen'), esc_url(get_permalink()), $time_string); } if ('post' == get_post_type()) { if (is_singular() || is_multi_author()) { printf('<span class="byline"><span class="author vcard"><span class="screen-reader-text">%1$s </span><a class="url fn n" href="%2$s">%3$s</a></span></span>', _x('Author', 'Used before post author name.', 'twentyfifteen'), esc_url(get_author_posts_url(get_the_author_meta('ID'))), get_the_author()); } } }
/** * Prints HTML with meta information for the categories, tags. */ function vanillamilkshake_entry_meta() { if (is_sticky() && is_home() && !is_paged()) { printf('<span class="sticky-post">%s</span>', __('Featured', 'vanillamilkshake')); } $format = get_post_format(); if (current_theme_supports('post-formats', $format)) { printf('<span class="entry-format">%1$s<a href="%2$s">%3$s</a></span>', sprintf('<span class="screen-reader-text">%s </span>', _x('Format', 'Used before post format.', 'vanillamilkshake')), esc_url(get_post_format_link($format)), get_post_format_string($format)); } if ('post' == get_post_type()) { if (is_singular() || is_multi_author()) { printf('<div class="byline marginbottom-medium"><span class="author vcard"><span class="screen-reader-text">%1$s </span><span class="light-gray">◆</span> <a class="url fn n" href="%2$s">%3$s</a></span></div>', _x('Author', 'Used before post author name.', 'vanillamilkshake'), esc_url(get_author_posts_url(get_the_author_meta('ID'))), get_the_author()); } /* divider between author & categories/tags */ printf('<div class="marginvertical-medium height-000625 backgroundcolor-light-gray"></div>'); $categories_list = get_the_category_list(' <span class="light-gray">▸</span> '); if ($categories_list && vanillamilkshake_categorized_blog()) { printf('<span class="cat-links xsmall"><span class="screen-reader-text">%1$s </span><span class="light-gray"> ▸</span> %2$s</span>', _x('Categories', 'Used before category names.', 'vanillamilkshake'), $categories_list); } $tags_list = get_the_tag_list('', ' <span class="light-gray">▸</span> '); if ($tags_list) { printf('<span class="tags-links xsmall"><span class="screen-reader-text">%1$s </span><span class="light-gray"> ▸</span> %2$s</span>', _x('Tags', 'Used before tag names.', 'vanillamilkshake'), $tags_list); } } if (is_attachment() && wp_attachment_is_image()) { // Retrieve attachment metadata. $metadata = wp_get_attachment_metadata(); printf('<span class="full-size-link"><span class="screen-reader-text">%1$s </span><a href="%2$s">%3$s × %4$s</a></span>', _x('Full size', 'Used before full size attachment link.', 'vanillamilkshake'), esc_url(wp_get_attachment_url()), $metadata['width'], $metadata['height']); } /* if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo '<div class="comments-link">'; comments_popup_link( __( 'Leave a comment', 'vanillamilkshake' ), __( '1 Comment', 'vanillamilkshake' ), __( '% Comments', 'vanillamilkshake' ) ); echo '</div>'; }*/ }
/** * Remove the post format prefix from the name property of the term objects created by wp_get_object_terms(). * * @access private * @since 3.1.0 */ function _post_format_wp_get_object_terms($terms) { foreach ((array) $terms as $order => $term) { if (isset($term->taxonomy) && 'post_format' == $term->taxonomy) { $terms[$order]->name = get_post_format_string(str_replace('post-format-', '', $term->slug)); } } return $terms; }
/** * Outputs the hidden row displayed when inline editing * * @since 3.1.0 * * @global string $mode */ public function inline_edit() { global $mode; $screen = $this->screen; $post = get_default_post_to_edit($screen->post_type); $post_type_object = get_post_type_object($screen->post_type); $taxonomy_names = get_object_taxonomies($screen->post_type); $hierarchical_taxonomies = array(); $flat_taxonomies = array(); foreach ($taxonomy_names as $taxonomy_name) { $taxonomy = get_taxonomy($taxonomy_name); $show_in_quick_edit = $taxonomy->show_in_quick_edit; /** * Filter whether the current taxonomy should be shown in the Quick Edit panel. * * @since 4.2.0 * * @param bool $show_in_quick_edit Whether to show the current taxonomy in Quick Edit. * @param string $taxonomy_name Taxonomy name. * @param string $post_type Post type of current Quick Edit post. */ if (!apply_filters('quick_edit_show_taxonomy', $show_in_quick_edit, $taxonomy_name, $screen->post_type)) { continue; } if ($taxonomy->hierarchical) { $hierarchical_taxonomies[] = $taxonomy; } else { $flat_taxonomies[] = $taxonomy; } } $m = isset($mode) && 'excerpt' == $mode ? 'excerpt' : 'list'; $can_publish = current_user_can($post_type_object->cap->publish_posts); $core_columns = array('cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true); ?> <form method="get"><table style="display: none"><tbody id="inlineedit"> <?php $hclass = count($hierarchical_taxonomies) ? 'post' : 'page'; $bulk = 0; while ($bulk < 2) { ?> <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?> " class="inline-edit-row inline-edit-row-<?php echo "{$hclass} inline-edit-" . $screen->post_type; echo $bulk ? " bulk-edit-row bulk-edit-row-{$hclass} bulk-edit-{$screen->post_type}" : " quick-edit-row quick-edit-row-{$hclass} inline-edit-{$screen->post_type}"; ?> " style="display: none"><td colspan="<?php echo $this->get_column_count(); ?> " class="colspanchange"> <fieldset class="inline-edit-col-left"><div class="inline-edit-col"> <h4><?php echo $bulk ? __('Bulk Edit') : __('Quick Edit'); ?> </h4> <?php if (post_type_supports($screen->post_type, 'title')) { if ($bulk) { ?> <div id="bulk-title-div"> <div id="bulk-titles"></div> </div> <?php } else { // $bulk ?> <label> <span class="title"><?php _e('Title'); ?> </span> <span class="input-text-wrap"><input type="text" name="post_title" class="ptitle" value="" /></span> </label> <label> <span class="title"><?php _e('Slug'); ?> </span> <span class="input-text-wrap"><input type="text" name="post_name" value="" /></span> </label> <?php } // $bulk } // post_type_supports title ?> <?php if (!$bulk) { ?> <fieldset class="inline-edit-date"> <legend><span class="title"><?php _e('Date'); ?> </span></legend> <?php touch_time(1, 1, 0, 1); ?> </fieldset> <br class="clear" /> <?php } // $bulk if (post_type_supports($screen->post_type, 'author')) { $authors_dropdown = ''; if (is_super_admin() || current_user_can($post_type_object->cap->edit_others_posts)) { $users_opt = array('hide_if_only_one_author' => false, 'who' => 'authors', 'name' => 'post_author', 'class' => 'authors', 'multi' => 1, 'echo' => 0); if ($bulk) { $users_opt['show_option_none'] = __('— No Change —'); } if ($authors = wp_dropdown_users($users_opt)) { $authors_dropdown = '<label class="inline-edit-author">'; $authors_dropdown .= '<span class="title">' . __('Author') . '</span>'; $authors_dropdown .= $authors; $authors_dropdown .= '</label>'; } } // authors ?> <?php if (!$bulk) { echo $authors_dropdown; } } // post_type_supports author if (!$bulk && $can_publish) { ?> <div class="inline-edit-group"> <label class="alignleft"> <span class="title"><?php _e('Password'); ?> </span> <span class="input-text-wrap"><input type="text" name="post_password" class="inline-edit-password-input" value="" /></span> </label> <em class="alignleft inline-edit-or"> <?php /* translators: Between password field and private checkbox on post quick edit interface */ _e('–OR–'); ?> </em> <label class="alignleft inline-edit-private"> <input type="checkbox" name="keep_private" value="private" /> <span class="checkbox-title"><?php _e('Private'); ?> </span> </label> </div> <?php } ?> </div></fieldset> <?php if (count($hierarchical_taxonomies) && !$bulk) { ?> <fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col"> <?php foreach ($hierarchical_taxonomies as $taxonomy) { ?> <span class="title inline-edit-categories-label"><?php echo esc_html($taxonomy->labels->name); ?> </span> <input type="hidden" name="<?php echo $taxonomy->name == 'category' ? 'post_category[]' : 'tax_input[' . esc_attr($taxonomy->name) . '][]'; ?> " value="0" /> <ul class="cat-checklist <?php echo esc_attr($taxonomy->name); ?> -checklist"> <?php wp_terms_checklist(null, array('taxonomy' => $taxonomy->name)); ?> </ul> <?php } //$hierarchical_taxonomies as $taxonomy ?> </div></fieldset> <?php } // count( $hierarchical_taxonomies ) && !$bulk ?> <fieldset class="inline-edit-col-right"><div class="inline-edit-col"> <?php if (post_type_supports($screen->post_type, 'author') && $bulk) { echo $authors_dropdown; } if (post_type_supports($screen->post_type, 'page-attributes')) { if ($post_type_object->hierarchical) { ?> <label> <span class="title"><?php _e('Parent'); ?> </span> <?php $dropdown_args = array('post_type' => $post_type_object->name, 'selected' => $post->post_parent, 'name' => 'post_parent', 'show_option_none' => __('Main Page (no parent)'), 'option_none_value' => 0, 'sort_column' => 'menu_order, post_title'); if ($bulk) { $dropdown_args['show_option_no_change'] = __('— No Change —'); } /** * Filter the arguments used to generate the Quick Edit page-parent drop-down. * * @since 2.7.0 * * @see wp_dropdown_pages() * * @param array $dropdown_args An array of arguments. */ $dropdown_args = apply_filters('quick_edit_dropdown_pages_args', $dropdown_args); wp_dropdown_pages($dropdown_args); ?> </label> <?php } // hierarchical if (!$bulk) { ?> <label> <span class="title"><?php _e('Order'); ?> </span> <span class="input-text-wrap"><input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order; ?> " /></span> </label> <?php } // !$bulk if ('page' == $screen->post_type) { ?> <label> <span class="title"><?php _e('Template'); ?> </span> <select name="page_template"> <?php if ($bulk) { ?> <option value="-1"><?php _e('— No Change —'); ?> </option> <?php } // $bulk ?> <?php /** This filter is documented in wp-admin/includes/meta-boxes.php */ $default_title = apply_filters('default_page_template_title', __('Default Template'), 'quick-edit'); ?> <option value="default"><?php echo esc_html($default_title); ?> </option> <?php page_template_dropdown(); ?> </select> </label> <?php } // page post_type } // page-attributes ?> <?php if (count($flat_taxonomies) && !$bulk) { ?> <?php foreach ($flat_taxonomies as $taxonomy) { ?> <?php if (current_user_can($taxonomy->cap->assign_terms)) { ?> <label class="inline-edit-tags"> <span class="title"><?php echo esc_html($taxonomy->labels->name); ?> </span> <textarea cols="22" rows="1" name="tax_input[<?php echo esc_attr($taxonomy->name); ?> ]" class="tax_input_<?php echo esc_attr($taxonomy->name); ?> "></textarea> </label> <?php } ?> <?php } //$flat_taxonomies as $taxonomy ?> <?php } // count( $flat_taxonomies ) && !$bulk ?> <?php if (post_type_supports($screen->post_type, 'comments') || post_type_supports($screen->post_type, 'trackbacks')) { if ($bulk) { ?> <div class="inline-edit-group"> <?php if (post_type_supports($screen->post_type, 'comments')) { ?> <label class="alignleft"> <span class="title"><?php _e('Comments'); ?> </span> <select name="comment_status"> <option value=""><?php _e('— No Change —'); ?> </option> <option value="open"><?php _e('Allow'); ?> </option> <option value="closed"><?php _e('Do not allow'); ?> </option> </select> </label> <?php } if (post_type_supports($screen->post_type, 'trackbacks')) { ?> <label class="alignright"> <span class="title"><?php _e('Pings'); ?> </span> <select name="ping_status"> <option value=""><?php _e('— No Change —'); ?> </option> <option value="open"><?php _e('Allow'); ?> </option> <option value="closed"><?php _e('Do not allow'); ?> </option> </select> </label> <?php } ?> </div> <?php } else { // $bulk ?> <div class="inline-edit-group"> <?php if (post_type_supports($screen->post_type, 'comments')) { ?> <label class="alignleft"> <input type="checkbox" name="comment_status" value="open" /> <span class="checkbox-title"><?php _e('Allow Comments'); ?> </span> </label> <?php } if (post_type_supports($screen->post_type, 'trackbacks')) { ?> <label class="alignleft"> <input type="checkbox" name="ping_status" value="open" /> <span class="checkbox-title"><?php _e('Allow Pings'); ?> </span> </label> <?php } ?> </div> <?php } // $bulk } // post_type_supports comments or pings ?> <div class="inline-edit-group"> <label class="inline-edit-status alignleft"> <span class="title"><?php _e('Status'); ?> </span> <select name="_status"> <?php if ($bulk) { ?> <option value="-1"><?php _e('— No Change —'); ?> </option> <?php } // $bulk ?> <?php if ($can_publish) { // Contributors only get "Unpublished" and "Pending Review" ?> <option value="publish"><?php _e('Published'); ?> </option> <option value="future"><?php _e('Scheduled'); ?> </option> <?php if ($bulk) { ?> <option value="private"><?php _e('Private'); ?> </option> <?php } // $bulk ?> <?php } ?> <option value="pending"><?php _e('Pending Review'); ?> </option> <option value="draft"><?php _e('Draft'); ?> </option> </select> </label> <?php if ('post' == $screen->post_type && $can_publish && current_user_can($post_type_object->cap->edit_others_posts)) { ?> <?php if ($bulk) { ?> <label class="alignright"> <span class="title"><?php _e('Sticky'); ?> </span> <select name="sticky"> <option value="-1"><?php _e('— No Change —'); ?> </option> <option value="sticky"><?php _e('Sticky'); ?> </option> <option value="unsticky"><?php _e('Not Sticky'); ?> </option> </select> </label> <?php } else { // $bulk ?> <label class="alignleft"> <input type="checkbox" name="sticky" value="sticky" /> <span class="checkbox-title"><?php _e('Make this post sticky'); ?> </span> </label> <?php } // $bulk ?> <?php } // 'post' && $can_publish && current_user_can( 'edit_others_cap' ) ?> </div> <?php if ($bulk && current_theme_supports('post-formats') && post_type_supports($screen->post_type, 'post-formats')) { $post_formats = get_theme_support('post-formats'); ?> <label class="alignleft"> <span class="title"><?php _ex('Format', 'post format'); ?> </span> <select name="post_format"> <option value="-1"><?php _e('— No Change —'); ?> </option> <option value="0"><?php echo get_post_format_string('standard'); ?> </option> <?php if (is_array($post_formats[0])) { foreach ($post_formats[0] as $format) { ?> <option value="<?php echo esc_attr($format); ?> "><?php echo esc_html(get_post_format_string($format)); ?> </option> <?php } } ?> </select></label> <?php } ?> </div></fieldset> <?php list($columns) = $this->get_column_info(); foreach ($columns as $column_name => $column_display_name) { if (isset($core_columns[$column_name])) { continue; } if ($bulk) { /** * Fires once for each column in Bulk Edit mode. * * @since 2.7.0 * * @param string $column_name Name of the column to edit. * @param WP_Post $post_type The post type slug. */ do_action('bulk_edit_custom_box', $column_name, $screen->post_type); } else { /** * Fires once for each column in Quick Edit mode. * * @since 2.7.0 * * @param string $column_name Name of the column to edit. * @param string $post_type The post type slug. */ do_action('quick_edit_custom_box', $column_name, $screen->post_type); } } ?> <p class="submit inline-edit-save"> <button type="button" class="button-secondary cancel alignleft"><?php _e('Cancel'); ?> </button> <?php if (!$bulk) { wp_nonce_field('inlineeditnonce', '_inline_edit', false); ?> <button type="button" class="button-primary save alignright"><?php _e('Update'); ?> </button> <span class="spinner"></span> <?php } else { submit_button(__('Update'), 'button-primary alignright', 'bulk_edit', false); } ?> <input type="hidden" name="post_view" value="<?php echo esc_attr($m); ?> " /> <input type="hidden" name="screen" value="<?php echo esc_attr($screen->id); ?> " /> <?php if (!$bulk && !post_type_supports($screen->post_type, 'author')) { ?> <input type="hidden" name="post_author" value="<?php echo esc_attr($post->post_author); ?> " /> <?php } ?> <span class="error" style="display:none"></span> <br class="clear" /> </p> </td></tr> <?php $bulk++; } ?> </tbody></table></form> <?php }
* * @package WordPress * @subpackage UT-TheHill * @since Twenty Thirteen 1.0 */ get_header(); ?> <div id="content" class="site-content" role="main"> <?php if (have_posts()) { ?> <header class="archive-header"> <h1 class="archive-title"><?php printf(__('%s Archives', 'utthehill'), '<span>' . get_post_format_string(get_post_format()) . '</span>'); ?> </h1> </header><!-- .archive-header --> <?php /* The loop */ ?> <?php while (have_posts()) { the_post(); ?> <?php get_template_part('content', get_post_format()); ?> <?php
* @package WordPress * @subpackage McKinley * @since McKinley 1.0 */ get_header(); ?> <div id="primary" class="content-area"> <div id="content" class="site-content" role="main"> <?php if (have_posts()) { ?> <header class="archive-header"> <h1 class="archive-title"><?php printf(__('%s Archives', 'mckinley'), '<span>' . get_post_format_string(get_post_format()) . '</span>'); ?> </h1> </header><!-- .archive-header --> <?php /* The loop */ ?> <?php while (have_posts()) { the_post(); ?> <?php get_template_part('content', get_post_format()); ?> <?php
<select name="default_post_format" id="default_post_format"> <option value="0"><?php _e('Standard'); ?> </option> <?php foreach ($post_formats[0] as $format) { ?> <option<?php selected(get_option('default_post_format'), $format); ?> value="<?php echo esc_attr($format); ?> "><?php echo esc_html(get_post_format_string($format)); ?> </option> <?php } ?> </select> </td> </tr> <?php } } ?> <tr valign="top"> <th scope="row"><label for="default_link_category"><?php _e('Default Link Category');
function woo_archive_title($before = '', $after = '', $echo = true) { global $wp_query; if (is_category() || is_tag() || is_tax()) { $taxonomy_obj = $wp_query->get_queried_object(); $term_id = $taxonomy_obj->term_id; $taxonomy_short_name = $taxonomy_obj->taxonomy; $taxonomy_raw_obj = get_taxonomy($taxonomy_short_name); } // End IF Statement $title = ''; $delimiter = ' | '; $date_format = get_option('date_format'); // Category Archive if (is_category()) { $title = '<span class="fl cat">' . __('Archive', 'woothemes') . $delimiter . single_cat_title('', false) . '</span> <span class="fr catrss">'; $cat_obj = $wp_query->get_queried_object(); $cat_id = $cat_obj->cat_ID; $title .= '<a href="' . get_term_feed_link($term_id, $taxonomy_short_name, '') . '" class="icon-rss icon-large" ></a></span>'; $has_title = true; } // Day Archive if (is_day()) { $title = __('Archive', 'woothemes') . $delimiter . get_the_time($date_format); } // Month Archive if (is_month()) { $date_format = apply_filters('woo_archive_title_date_format', 'F, Y'); $title = __('Archive', 'woothemes') . $delimiter . get_the_time($date_format); } // Year Archive if (is_year()) { $date_format = apply_filters('woo_archive_title_date_format', 'Y'); $title = __('Archive', 'woothemes') . $delimiter . get_the_time($date_format); } // Author Archive if (is_author()) { $title = __('Author Archive', 'woothemes') . $delimiter . get_the_author_meta('display_name', get_query_var('author')); } // Tag Archive if (is_tag()) { $title = __('Tag Archives', 'woothemes') . $delimiter . single_tag_title('', false); } // Post Type Archive if (function_exists('is_post_type_archive') && is_post_type_archive()) { /* Get the post type object. */ $post_type_object = get_post_type_object(get_query_var('post_type')); $title = $post_type_object->labels->name . ' ' . __('Archive', 'woothemes'); } // Post Format Archive if (get_query_var('taxonomy') == 'post_format') { $post_format = str_replace('post-format-', '', get_query_var('post_format')); $title = get_post_format_string($post_format) . ' ' . __(' Archives', 'woothemes'); } // General Taxonomy Archive if (is_tax()) { $title = sprintf(__('%1$s Archives: %2$s', 'woothemes'), $taxonomy_raw_obj->labels->name, $taxonomy_obj->name); } if (strlen($title) == 0) { return; } $title = $before . $title . $after; // Allow for external filters to manipulate the title value. $title = apply_filters('woo_archive_title', $title, $before, $after); if ($echo) { echo $title; } else { return $title; } }
_e('Sticky', 'themeum'); ?> </sup> <?php } ?> </h2> <div class="entry-meta"> <ul> <li class="post-format"> <i class="fa fa-picture-o"></i> <a class="entry-format" href="<?php echo esc_url(get_post_format_link('gallery')); ?> "><?php echo get_post_format_string('gallery'); ?> </a> </li> <li class="date"><i class="fa fa-clock-o"></i> <time class="entry-date" datetime="<?php the_time('c'); ?> "><?php the_time('j M Y'); ?> </time></li> <li class="author"><i class="fa fa-pencil"></i> <?php the_author_posts_link(); ?> </li> <li class="category"><i class="fa fa-paperclip"></i> <?php
the_title_attribute(); ?> " class="tile-content<?php if (!has_post_thumbnail()) { ?> no-thumbnail<?php } ?> " rel="bookmark"> <div class="entry-meta"> <?php $category = get_the_category(); echo '<h3>' . $category[0]->cat_name . '</h3>'; if (has_post_format()) { echo get_post_format_string(get_post_format()); } ?> <span><time datetime="<?php the_time('Y-m-d'); ?> "><?php the_date('j F Y', '<br />', '<br />'); ?> </time></span> </div><!-- .entry-meta --> <h1 class="entry-title"><?php the_title();
<?php } if (is_single()) { the_title('<h1 class="entry-title">', '</h1>'); } else { the_title('<h1 class="entry-title"><a href="' . esc_url(get_permalink()) . '" rel="bookmark">', '</a></h1>'); } ?> <div class="entry-meta"> <span class="post-format"> <a class="entry-format" href="<?php echo esc_url(get_post_format_link('aside')); ?> "><?php echo get_post_format_string('aside'); ?> </a> </span> <?php twentyfourteen_posted_on(); ?> <?php if (!post_password_required() && (comments_open() || get_comments_number())) { ?> <span class="comments-link"><?php comments_popup_link(__('Leave a comment', 'twentyfourteen'), __('1 Comment', 'twentyfourteen'), __('% Comments', 'twentyfourteen')); ?> </span>
function single_row($post, $level = 0) { global $mode; static $alternate; $global_post = get_post(); $GLOBALS['post'] = $post; setup_postdata($post); $edit_link = get_edit_post_link($post->ID); $title = _draft_or_post_title(); $post_type_object = get_post_type_object($post->post_type); $can_edit_post = current_user_can('edit_post', $post->ID); $alternate = 'alternate' == $alternate ? '' : 'alternate'; $classes = $alternate . ' iedit author-' . (get_current_user_id() == $post->post_author ? 'self' : 'other'); $lock_holder = wp_check_post_lock($post->ID); if ($lock_holder) { $classes .= ' wp-locked'; $lock_holder = get_userdata($lock_holder); } ?> <tr id="post-<?php echo $post->ID; ?> " class="<?php echo implode(' ', get_post_class($classes, $post->ID)); ?> " valign="top"> <?php list($columns, $hidden) = $this->get_column_info(); foreach ($columns as $column_name => $column_display_name) { $class = "class=\"{$column_name} column-{$column_name}\""; $style = ''; if (in_array($column_name, $hidden)) { $style = ' style="display:none;"'; } $attributes = "{$class}{$style}"; switch ($column_name) { case 'cb': ?> <th scope="row" class="check-column"> <?php if ($can_edit_post) { ?> <label class="screen-reader-text" for="cb-select-<?php the_ID(); ?> "><?php printf(__('Select %s'), $title); ?> </label> <input id="cb-select-<?php the_ID(); ?> " type="checkbox" name="post[]" value="<?php the_ID(); ?> " /> <div class="locked-indicator"></div> <?php } ?> </th> <?php break; case 'title': $attributes = 'class="post-title page-title column-title"' . $style; if ($this->hierarchical_display) { if (0 == $level && (int) $post->post_parent > 0) { //sent level 0 by accident, by default, or because we don't know the actual level $find_main_page = (int) $post->post_parent; while ($find_main_page > 0) { $parent = get_post($find_main_page); if (is_null($parent)) { break; } $level++; $find_main_page = (int) $parent->post_parent; if (!isset($parent_name)) { /** This filter is documented in wp-includes/post-template.php */ $parent_name = apply_filters('the_title', $parent->post_title, $parent->ID); } } } } $pad = str_repeat('— ', $level); echo "<td {$attributes}><strong>"; if ($format = get_post_format($post->ID)) { $label = get_post_format_string($format); echo '<a href="' . esc_url(add_query_arg(array('post_format' => $format, 'post_type' => $post->post_type), 'edit.php')) . '" class="post-state-format post-format-icon post-format-' . $format . '" title="' . $label . '">' . $label . ":</a> "; } if ($can_edit_post && $post->post_status != 'trash') { echo '<a class="row-title" href="' . $edit_link . '" title="' . esc_attr(sprintf(__('Edit “%s”'), $title)) . '">' . $pad . $title . '</a>'; } else { echo $pad . $title; } _post_states($post); if (isset($parent_name)) { echo ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html($parent_name); } echo "</strong>\n"; if ($can_edit_post && $post->post_status != 'trash') { if ($lock_holder) { $locked_avatar = get_avatar($lock_holder->ID, 18); $locked_text = esc_html(sprintf(__('%s is currently editing'), $lock_holder->display_name)); } else { $locked_avatar = $locked_text = ''; } echo '<div class="locked-info"><span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span></div>\n"; } if (!$this->hierarchical_display && 'excerpt' == $mode && current_user_can('read_post', $post->ID)) { the_excerpt(); } $actions = array(); if ($can_edit_post && 'trash' != $post->post_status) { $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this item')) . '">' . __('Edit') . '</a>'; $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this item inline')) . '">' . __('Quick Edit') . '</a>'; } if (current_user_can('delete_post', $post->ID)) { if ('trash' == $post->post_status) { $actions['untrash'] = "<a title='" . esc_attr(__('Restore this item from the Trash')) . "' href='" . wp_nonce_url(admin_url(sprintf($post_type_object->_edit_link . '&action=untrash', $post->ID)), 'untrash-post_' . $post->ID) . "'>" . __('Restore') . "</a>"; } elseif (EMPTY_TRASH_DAYS) { $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this item to the Trash')) . "' href='" . get_delete_post_link($post->ID) . "'>" . __('Trash') . "</a>"; } if ('trash' == $post->post_status || !EMPTY_TRASH_DAYS) { $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this item permanently')) . "' href='" . get_delete_post_link($post->ID, '', true) . "'>" . __('Delete Permanently') . "</a>"; } } if ($post_type_object->public) { if (in_array($post->post_status, array('pending', 'draft', 'future'))) { if ($can_edit_post) { $actions['view'] = '<a href="' . esc_url(apply_filters('preview_post_link', set_url_scheme(add_query_arg('preview', 'true', get_permalink($post->ID))))) . '" title="' . esc_attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">' . __('Preview') . '</a>'; } } elseif ('trash' != $post->post_status) { $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View “%s”'), $title)) . '" rel="permalink">' . __('View') . '</a>'; } } $actions = apply_filters(is_post_type_hierarchical($post->post_type) ? 'page_row_actions' : 'post_row_actions', $actions, $post); echo $this->row_actions($actions); get_inline_data($post); echo '</td>'; break; case 'date': if ('0000-00-00 00:00:00' == $post->post_date) { $t_time = $h_time = __('Unpublished'); $time_diff = 0; } else { $t_time = get_the_time(__('Y/m/d g:i:s A')); $m_time = $post->post_date; $time = get_post_time('G', true, $post); $time_diff = time() - $time; if ($time_diff > 0 && $time_diff < DAY_IN_SECONDS) { $h_time = sprintf(__('%s ago'), human_time_diff($time)); } else { $h_time = mysql2date(__('Y/m/d'), $m_time); } } echo '<td ' . $attributes . '>'; if ('excerpt' == $mode) { echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode); } else { echo '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) . '</abbr>'; } echo '<br />'; if ('publish' == $post->post_status) { _e('Published'); } elseif ('future' == $post->post_status) { if ($time_diff > 0) { echo '<strong class="attention">' . __('Missed schedule') . '</strong>'; } else { _e('Scheduled'); } } else { _e('Last Modified'); } echo '</td>'; break; case 'comments': ?> <td <?php echo $attributes; ?> ><div class="post-com-count-wrapper"> <?php $pending_comments = isset($this->comment_pending_count[$post->ID]) ? $this->comment_pending_count[$post->ID] : 0; $this->comments_bubble($post->ID, $pending_comments); ?> </div></td> <?php break; case 'author': ?> <td <?php echo $attributes; ?> ><?php printf('<a href="%s">%s</a>', esc_url(add_query_arg(array('post_type' => $post->post_type, 'author' => get_the_author_meta('ID')), 'edit.php')), get_the_author()); ?> </td> <?php break; default: if ('categories' == $column_name) { $taxonomy = 'category'; } elseif ('tags' == $column_name) { $taxonomy = 'post_tag'; } elseif (0 === strpos($column_name, 'taxonomy-')) { $taxonomy = substr($column_name, 9); } else { $taxonomy = false; } if ($taxonomy) { $taxonomy_object = get_taxonomy($taxonomy); echo '<td ' . $attributes . '>'; if ($terms = get_the_terms($post->ID, $taxonomy)) { $out = array(); foreach ($terms as $t) { $posts_in_term_qv = array(); if ('post' != $post->post_type) { $posts_in_term_qv['post_type'] = $post->post_type; } if ($taxonomy_object->query_var) { $posts_in_term_qv[$taxonomy_object->query_var] = $t->slug; } else { $posts_in_term_qv['taxonomy'] = $taxonomy; $posts_in_term_qv['term'] = $t->slug; } $out[] = sprintf('<a href="%s">%s</a>', esc_url(add_query_arg($posts_in_term_qv, 'edit.php')), esc_html(sanitize_term_field('name', $t->name, $t->term_id, $taxonomy, 'display'))); } /* translators: used between list items, there is a space after the comma */ echo join(__(', '), $out); } else { echo '—'; } echo '</td>'; break; } ?> <td <?php echo $attributes; ?> ><?php if (is_post_type_hierarchical($post->post_type)) { do_action('manage_pages_custom_column', $column_name, $post->ID); } else { do_action('manage_posts_custom_column', $column_name, $post->ID); } do_action("manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID); ?> </td> <?php break; } } ?> </tr> <?php $GLOBALS['post'] = $global_post; }
/** * Serves the app's base HTML, which in turns calls the load script. * * @since 4.2.0 * @access public * * @global WP_Locale $wp_locale * @global string $wp_version * @global bool $is_IE */ public function html() { global $wp_locale, $wp_version; // Get data, new (POST) and old (GET). $data = $this->merge_or_fetch_data(); $post_title = $this->get_suggested_title($data); $post_content = $this->get_suggested_content($data); // Get site settings array/data. $site_settings = $this->site_settings(); // Pass the images and embeds $images = $this->get_images($data); $embeds = $this->get_embeds($data); $site_data = array('v' => !empty($data['v']) ? $data['v'] : '', 'u' => !empty($data['u']) ? $data['u'] : '', 'hasData' => !empty($data)); if (!empty($images)) { $site_data['_images'] = $images; } if (!empty($embeds)) { $site_data['_embeds'] = $embeds; } // Add press-this-editor.css and remove theme's editor-style.css, if any. remove_editor_styles(); add_filter('mce_css', array($this, 'add_editor_style')); if (!empty($GLOBALS['is_IE'])) { @header('X-UA-Compatible: IE=edge'); } @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset')); ?> <!DOCTYPE html> <!--[if IE 7]> <html class="lt-ie9 lt-ie8" <?php language_attributes(); ?> > <![endif]--> <!--[if IE 8]> <html class="lt-ie9" <?php language_attributes(); ?> > <![endif]--> <!--[if gt IE 8]><!--> <html <?php language_attributes(); ?> > <!--<![endif]--> <head> <meta http-equiv="Content-Type" content="<?php echo esc_attr(get_bloginfo('html_type')); ?> ; charset=<?php echo esc_attr(get_option('blog_charset')); ?> " /> <meta name="viewport" content="width=device-width"> <title><?php esc_html_e('Press This!'); ?> </title> <script> window.wpPressThisData = <?php echo wp_json_encode($site_data); ?> ; window.wpPressThisConfig = <?php echo wp_json_encode($site_settings); ?> ; </script> <script type="text/javascript"> var ajaxurl = '<?php echo esc_js(admin_url('admin-ajax.php', 'relative')); ?> ', pagenow = 'press-this', typenow = 'post', adminpage = 'press-this-php', thousandsSeparator = '<?php echo addslashes($wp_locale->number_format['thousands_sep']); ?> ', decimalPoint = '<?php echo addslashes($wp_locale->number_format['decimal_point']); ?> ', isRtl = <?php echo (int) is_rtl(); ?> ; </script> <?php /* * $post->ID is needed for the embed shortcode so we can show oEmbed previews in the editor. * Maybe find a way without it. */ $post = get_default_post_to_edit('post', true); $post_ID = (int) $post->ID; wp_enqueue_media(array('post' => $post_ID)); wp_enqueue_style('press-this'); wp_enqueue_script('press-this'); wp_enqueue_script('json2'); wp_enqueue_script('editor'); $supports_formats = false; $post_format = 0; if (current_theme_supports('post-formats') && post_type_supports($post->post_type, 'post-formats')) { $supports_formats = true; if (!($post_format = get_post_format($post_ID))) { $post_format = 0; } } /** This action is documented in wp-admin/admin-header.php */ do_action('admin_enqueue_scripts', 'press-this.php'); /** This action is documented in wp-admin/admin-header.php */ do_action('admin_print_styles-press-this.php'); /** This action is documented in wp-admin/admin-header.php */ do_action('admin_print_styles'); /** This action is documented in wp-admin/admin-header.php */ do_action('admin_print_scripts-press-this.php'); /** This action is documented in wp-admin/admin-header.php */ do_action('admin_print_scripts'); /** This action is documented in wp-admin/admin-header.php */ do_action('admin_head-press-this.php'); /** This action is documented in wp-admin/admin-header.php */ do_action('admin_head'); ?> </head> <?php $admin_body_class = 'press-this'; $admin_body_class .= is_rtl() ? ' rtl' : ''; $admin_body_class .= ' branch-' . str_replace(array('.', ','), '-', floatval($wp_version)); $admin_body_class .= ' version-' . str_replace('.', '-', preg_replace('/^([.0-9]+).*/', '$1', $wp_version)); $admin_body_class .= ' admin-color-' . sanitize_html_class(get_user_option('admin_color'), 'fresh'); $admin_body_class .= ' locale-' . sanitize_html_class(strtolower(str_replace('_', '-', get_locale()))); /** This filter is documented in wp-admin/admin-header.php */ $admin_body_classes = apply_filters('admin_body_class', ''); ?> <body class="wp-admin wp-core-ui <?php echo $admin_body_classes . ' ' . $admin_body_class; ?> "> <div id="adminbar" class="adminbar"> <h1 id="current-site" class="current-site"> <a class="current-site-link" href="<?php echo esc_url(home_url('/')); ?> " target="_blank" rel="home"> <span class="dashicons dashicons-wordpress"></span> <span class="current-site-name"><?php bloginfo('name'); ?> </span> </a> </h1> <button type="button" class="options button-subtle closed"> <span class="dashicons dashicons-tag on-closed"></span> <span class="screen-reader-text on-closed"><?php _e('Show post options'); ?> </span> <span aria-hidden="true" class="on-open"><?php _e('Done'); ?> </span> <span class="screen-reader-text on-open"><?php _e('Hide post options'); ?> </span> </button> </div> <div id="scanbar" class="scan"> <form method="GET"> <label for="url-scan" class="screen-reader-text"><?php _e('Scan site for content'); ?> </label> <input type="url" name="u" id="url-scan" class="scan-url" value="" placeholder="<?php esc_attr_e('Enter a URL to scan'); ?> " /> <input type="submit" name="url-scan-submit" id="url-scan-submit" class="scan-submit" value="<?php esc_attr_e('Scan'); ?> " /> </form> </div> <form id="pressthis-form" method="post" action="post.php" autocomplete="off"> <input type="hidden" name="post_ID" id="post_ID" value="<?php echo $post_ID; ?> " /> <input type="hidden" name="action" value="press-this-save-post" /> <input type="hidden" name="post_status" id="post_status" value="draft" /> <input type="hidden" name="wp-preview" id="wp-preview" value="" /> <input type="hidden" name="post_title" id="post_title" value="" /> <?php wp_nonce_field('update-post_' . $post_ID, '_wpnonce', false); wp_nonce_field('add-category', '_ajax_nonce-add-category', false); ?> <div class="wrapper"> <div class="editor-wrapper"> <div class="alerts" role="alert" aria-live="assertive" aria-relevant="all" aria-atomic="true"> <?php if (isset($data['v']) && $this->version > $data['v']) { ?> <p class="alert is-notice"> <?php printf(__('You should upgrade <a href="%s" target="_blank">your bookmarklet</a> to the latest version!'), admin_url('tools.php')); ?> </p> <?php } ?> </div> <div id="app-container" class="editor"> <span id="title-container-label" class="post-title-placeholder" aria-hidden="true"><?php _e('Post title'); ?> </span> <h2 id="title-container" class="post-title" contenteditable="true" spellcheck="true" aria-label="<?php esc_attr_e('Post title'); ?> " tabindex="0"><?php echo esc_html($post_title); ?> </h2> <div class="media-list-container"> <div class="media-list-inner-container"> <h2 class="screen-reader-text"><?php _e('Suggested media'); ?> </h2> <ul class="media-list"></ul> </div> </div> <?php wp_editor($post_content, 'pressthis', array('drag_drop_upload' => true, 'editor_height' => 600, 'media_buttons' => false, 'textarea_name' => 'post_content', 'teeny' => true, 'tinymce' => array('resize' => false, 'wordpress_adv_hidden' => false, 'add_unload_trigger' => false, 'statusbar' => false, 'autoresize_min_height' => 600, 'wp_autoresize_on' => true, 'plugins' => 'lists,media,paste,tabfocus,fullscreen,wordpress,wpautoresize,wpeditimage,wpgallery,wplink,wpview', 'toolbar1' => 'bold,italic,bullist,numlist,blockquote,link,unlink', 'toolbar2' => 'undo,redo'), 'quicktags' => false)); ?> </div> </div> <div class="options-panel-back is-hidden" tabindex="-1"></div> <div class="options-panel is-off-screen is-hidden" tabindex="-1"> <div class="post-options"> <?php if ($supports_formats) { ?> <button type="button" class="button-reset post-option"> <span class="dashicons dashicons-admin-post"></span> <span class="post-option-title"><?php _ex('Format', 'post format'); ?> </span> <span class="post-option-contents" id="post-option-post-format"><?php echo esc_html(get_post_format_string($post_format)); ?> </span> <span class="dashicons post-option-forward"></span> </button> <?php } ?> <button type="button" class="button-reset post-option"> <span class="dashicons dashicons-category"></span> <span class="post-option-title"><?php _e('Categories'); ?> </span> <span class="dashicons post-option-forward"></span> </button> <button type="button" class="button-reset post-option"> <span class="dashicons dashicons-tag"></span> <span class="post-option-title"><?php _e('Tags'); ?> </span> <span class="dashicons post-option-forward"></span> </button> </div> <?php if ($supports_formats) { ?> <div class="setting-modal is-off-screen is-hidden"> <button type="button" class="button-reset modal-close"> <span class="dashicons post-option-back"></span> <span class="setting-title" aria-hidden="true"><?php _ex('Format', 'post format'); ?> </span> <span class="screen-reader-text"><?php _e('Back to post options'); ?> </span> </button> <?php $this->post_formats_html($post); ?> </div> <?php } ?> <div class="setting-modal is-off-screen is-hidden"> <button type="button" class="button-reset modal-close"> <span class="dashicons post-option-back"></span> <span class="setting-title" aria-hidden="true"><?php _e('Categories'); ?> </span> <span class="screen-reader-text"><?php _e('Back to post options'); ?> </span> </button> <?php $this->categories_html($post); ?> </div> <div class="setting-modal tags is-off-screen is-hidden"> <button type="button" class="button-reset modal-close"> <span class="dashicons post-option-back"></span> <span class="setting-title" aria-hidden="true"><?php _e('Tags'); ?> </span> <span class="screen-reader-text"><?php _e('Back to post options'); ?> </span> </button> <?php $this->tags_html($post); ?> </div> </div><!-- .options-panel --> </div><!-- .wrapper --> <div class="press-this-actions"> <div class="pressthis-media-buttons"> <button type="button" class="insert-media button-subtle" data-editor="pressthis"> <span class="dashicons dashicons-admin-media"></span> <span class="screen-reader-text"><?php _e('Add Media'); ?> </span> </button> </div> <div class="post-actions"> <span class="spinner"> </span> <div class="split-button"> <div class="split-button-head"> <button type="button" class="publish-button split-button-primary"><?php echo current_user_can('publish_posts') ? __('Publish') : __('Submit for Review'); ?> </button><button type="button" class="split-button-toggle" aria-haspopup="true" aria-expanded="false"> <i class="dashicons dashicons-arrow-down-alt2"></i> <span class="screen-reader-text"><?php _e('More actions'); ?> </span> </button> </div> <ul class="split-button-body"> <li><button type="button" class="button-subtle draft-button split-button-option" aria-live="polite"><?php _e('Save Draft'); ?> </button></li> <li><a href="<?php echo esc_url(get_edit_post_link($post_ID)); ?> " class="edit-post-link split-button-option" target="_blank"><?php _e('Standard Editor'); ?> </a></li> <li><button type="button" class="button-subtle preview-button split-button-option"><?php _e('Preview'); ?> </button></li> </ul> </div> </div> </div> </form> <?php /** This action is documented in wp-admin/admin-footer.php */ do_action('admin_footer'); /** This action is documented in wp-admin/admin-footer.php */ do_action('admin_print_footer_scripts'); /** This action is documented in wp-admin/admin-footer.php */ do_action('admin_footer-press-this.php'); ?> </body> </html> <?php die; }