コード例 #1
2
 function presscore_search_title_shortcode()
 {
     $title = '';
     $wrap_class = '';
     if (is_search()) {
         $title = get_search_query();
     } else {
         if (is_archive()) {
             if (is_category()) {
                 $title = single_cat_title('', false);
             } elseif (is_tag()) {
                 $title = single_tag_title('', false);
             } elseif (is_author()) {
                 the_post();
                 $title = '<a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta("ID"))) . '" title="' . esc_attr(get_the_author()) . '" rel="me">' . get_the_author() . '</a>';
                 $wrap_class .= ' vcard';
                 rewind_posts();
             } elseif (is_day()) {
                 $title = '<span>' . get_the_date() . '</span>';
             } elseif (is_month()) {
                 $title = '<span>' . get_the_date('F Y');
             } elseif (is_year()) {
                 $title = '<span>' . get_the_date('Y');
             } elseif (is_tax('dt_portfolio_category')) {
                 $title = single_term_title('', false);
             } elseif (is_tax('dt_gallery_category')) {
                 $title = single_term_title('', false);
             }
         }
     }
     if ($title) {
         $title = '<span' . ($wrap_class ? ' class="' . esc_attr($wrap_class) . '"' : '') . '>' . $title . '</span>';
     }
     return $title;
 }
コード例 #2
1
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>';
    }
}
コード例 #3
1
 /**
  * Prints HTML with meta information for the current post-date/time and author.
  */
 function square_posted_on()
 {
     $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')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()));
     $posted_on = sprintf(esc_html_x('%s', 'post date', 'square'), '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>');
     $byline = sprintf(esc_html_x('by %s', 'post author', 'square'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>');
     $comment_count = get_comments_number();
     // get_comments_number returns only a numeric value
     if (comments_open()) {
         if ($comment_count == 0) {
             $comments = __('No Comments', 'square');
         } elseif ($comment_count > 1) {
             $comments = $comment_count . __(' Comments', 'square');
         } else {
             $comments = __('1 Comment', 'square');
         }
         $comment_link = '<a href="' . get_comments_link() . '">' . $comments . '</a>';
     } else {
         $comment_link = __(' Comment Closed', 'square');
     }
     echo '<span class="posted-on"><i class="fa fa-clock-o"></i>' . $posted_on . '</span><span class="byline"> ' . $byline . '</span><span class="comment-count"><i class="fa fa-comments-o"></i>' . $comment_link . "</span>";
     // WPCS: XSS OK.
 }
コード例 #4
0
 function test_get_the_author()
 {
     $author_name = get_the_author();
     $user = new WP_User($this->author_id);
     $this->assertEquals($user->display_name, $author_name);
     $this->assertEquals('test_author', $author_name);
 }
コード例 #5
0
ファイル: Post.php プロジェクト: silversite/silverwp
 /**
  * Latest blog posts
  *
  * @param int    $limit post display limit
  *
  * @param string $thumbnail_size
  *
  * @return array
  */
 public static function getRecent($limit = 10, $thumbnail_size = 'thumbnail')
 {
     $args = array('numberposts' => $limit, 'offset' => 0, 'category' => 0, 'orderby' => 'post_date', 'order' => 'DESC', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_type' => 'post', 'post_status' => 'draft, publish, future, pending', 'suppress_filters' => true);
     $array_out = array();
     $recent_posts = \get_posts(\wp_parse_args($args));
     /*$like_bool    = Option::get_theme_option( 'blog_list_like' );
       if ( $like_bool === '1' ) {
           $PostLike = \SilverWp\Ajax\PostLike::getInstance();
       }*/
     foreach ($recent_posts as $key => $recent) {
         \setup_postdata($recent);
         $post_id = $recent->ID;
         //$array_out[ $key ] = $recent;
         $array_out[$key]['ID'] = $post_id;
         $array_out[$key]['post_title'] = \get_the_title($post_id);
         $array_out[$key]['url'] = \get_the_permalink($post_id);
         $array_out[$key]['post_author'] = \get_the_author();
         $array_out[$key]['post_date'] = \get_the_date('', $post_id);
         $array_out[$key]['post_date_utc'] = \get_the_time('c', $post_id);
         //$array_out[ $key ]['post_like'] = ($like_bool === '1') ? $PostLike->getPostLikeCount($post_id) : '';
         $array_out[$key]['post_comment_count'] = $recent->comment_count;
         if (strpos($recent->post_content, '<!--more-->') || empty($recent->post_excerpt)) {
             $array_out[$key]['post_excerpt'] = \get_the_excerpt();
         } else {
             $array_out[$key]['post_excerpt'] = $recent->post_excerpt;
         }
         $array_out[$key]['image_html'] = \get_the_post_thumbnail($post_id, $thumbnail_size);
         // Thumbnail
         $array_out[$key]['categories'] = self::getTaxonomy($post_id);
     }
     \wp_reset_postdata();
     return $array_out;
 }
コード例 #6
0
 /**
  * Prints HTML with meta information for the categories, tags and comments.
  */
 function ushipnetwork_entry_footer()
 {
     // Hide category and tag text for pages.
     if ('post' === get_post_type()) {
         $byline = sprintf(esc_html_x('by %s', 'post author', 'ushipnetwork'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>');
         echo '<div class="byline">' . '<div class="authorship">' . $byline . '</div>' . '<div class="share">';
         include "share.php";
         echo '</div>' . '</div>';
         $posttags = get_the_tags();
         $count = 0;
         $separator = ', ';
         $output = '';
         if (!empty($posttags)) {
             echo '<span class="tag-list">tags: ';
             foreach ($posttags as $posttag) {
                 $count++;
                 if ($count <= 2) {
                     $output .= '<a href="' . esc_url(get_tag_link($posttag->term_id)) . '" alt="' . esc_attr(sprintf(__('View all posts in %s', 'textdomain'), $posttag->name)) . '">' . esc_html($posttag->name) . '</a>' . $separator;
                 }
             }
             echo trim($output, $separator);
         }
         echo '</span>';
     }
     edit_post_link(sprintf(esc_html__('Edit %s', 'ushipnetwork'), the_title('<span class="screen-reader-text">"', '"</span>', false)), '<span class="edit-link">', '</span>');
 }
コード例 #7
0
 function bl_posttype_shortcodes_showposts($params = array())
 {
     // Pulls the paramater values passed from the shortcode options
     extract(shortcode_atts(array('post_type' => 'post', 'post_status' => 'publish', 'offset' => 0, 'posts_per_page' => ''), $params));
     // Builds the query based on the available params
     $query = new WP_Query(array('post_type' => $post_type, 'post_status' => $post_status, 'offset' => $offset, 'posts_per_page' => $posts_per_page));
     // Looks for the presence of any qualifying posts inside the defined loop
     if ($query->have_posts()) {
         // We open the post container only where specified posts are available
         $shortcodeOutput = '<div>';
         while ($query->have_posts()) {
             $query->the_post();
             // Wraps each qualifying post for output in an <article> tag with Schema data.
             $shortcodeOutput .= '<article itemscope itemtype="http://schema.org/Article">';
             $shortcodeOutput .= '<a href="' . get_the_permalink() . '">';
             $shortcodeOutput .= '<h3 itemprop="name">' . get_the_title() . '</h3>';
             $shortcodeOutput .= '</a>';
             $shortcodeOutput .= '<time itemprop="dateCreated">' . get_the_date() . '</time>';
             $shortcodeOutput .= '<em itemprop="author">' . get_the_author() . '</em>';
             $shortcodeOutput .= '<div itemprop="description">' . get_the_excerpt() . '</div>';
             $shortcodeOutput .= '<article>';
         }
         // Closes off the parent container
         $shortcodeOutput .= '</div>';
     }
     // Resets the wordpress loop
     wp_reset_postdata();
     // Returns the concatenated shortcodeOutput to the page
     return $shortcodeOutput;
 }
コード例 #8
0
 /**
  * Shim for `sociallyviral_archive_title()`.
  *
  * Display the archive title based on the queried object.
  *
  * @todo Remove this function when WordPress 4.3 is released.
  *
  * @param string $before Optional. Content to prepend to the title. Default empty.
  * @param string $after  Optional. Content to append to the title. Default empty.
  */
 function sociallyviral_archive_title($before = '', $after = '')
 {
     if (is_category()) {
         $title = sprintf(__('Category: %s', 'sociallyviral'), single_cat_title('', false));
     } elseif (is_tag()) {
         $title = sprintf(__('Tag: %s', 'sociallyviral'), single_tag_title('', false));
     } elseif (is_author()) {
         $title = sprintf(__('Author: %s', 'sociallyviral'), '<span class="vcard">' . get_the_author() . '</span>');
     } elseif (is_year()) {
         $title = sprintf(__('Year: %s', 'sociallyviral'), get_the_date(_x('Y', 'yearly archives date format', 'sociallyviral')));
     } elseif (is_month()) {
         $title = sprintf(__('Month: %s', 'sociallyviral'), get_the_date(_x('F Y', 'monthly archives date format', 'sociallyviral')));
     } elseif (is_day()) {
         $title = sprintf(__('Day: %s', 'sociallyviral'), get_the_date(_x('F j, Y', 'daily archives date format', 'sociallyviral')));
     } elseif (is_post_type_archive()) {
         $title = sprintf(__('Archives: %s', 'sociallyviral'), post_type_archive_title('', false));
     } elseif (is_tax()) {
         $tax = get_taxonomy(get_queried_object()->taxonomy);
         /* translators: 1: Taxonomy singular name, 2: Current taxonomy term */
         $title = sprintf(__('%1$s: %2$s', 'sociallyviral'), $tax->labels->singular_name, single_term_title('', false));
     } else {
         $title = __('Archives', 'sociallyviral');
     }
     /**
      * Filter the archive title.
      *
      * @param string $title Archive title to be displayed.
      */
     $title = apply_filters('get_the_archive_title', $title);
     if (!empty($title)) {
         echo $before . $title . $after;
     }
 }
コード例 #9
0
/**
 * This is a duplicate of the above. Probably delete others
 */
function kanec_entry_meta()
{
    // Time
    $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')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()));
    echo '<div class="posted-on"><i class="icon icon-calendar-o"></i><a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a></div>';
    // Author
    echo '<div class="byline"><i class="icon icon-user"></i><span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span></div>';
    // Categories & Tags
    // Hide category and tag text for pages.
    if ('post' === get_post_type()) {
        /* translators: used between list items, there is a space after the comma */
        $categories_list = get_the_category_list(esc_html__(', ', 'kanec'));
        if ($categories_list && kanec_categorized_blog()) {
            echo '<div class="cat-links"><i class="icon icon-folder-open"></i>' . $categories_list . '</div>';
        }
        /* translators: used between list items, there is a space after the comma */
        $tags_list = get_the_tag_list('', esc_html__(', ', 'kanec'));
        if ($tags_list) {
            echo '<div class="tags-links"><i class="icon icon-tags"></i>' . $tags_list . '</div>';
        }
    }
    if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) {
        echo '<div class="comments-link"><i class="icon icon-comments"></i>';
        comments_popup_link(esc_html__('Leave a comment', 'kanec'), esc_html__('1 Comment', 'kanec'), esc_html__('% Comments', 'kanec'));
        echo '</div>';
    }
}
コード例 #10
0
        $text = $page;
    } elseif (is_single()) {
        $text = $single;
    }
    return $before . '<a href="' . get_permalink(get_the_ID()) . '" class="' . $class . '" >' . $text . '</a>' . $after;
}
/** [author], [the_author] */
function stf_the_author_shortcode($args)
コード例 #11
0
ファイル: template-tags.php プロジェクト: AndyA/River
    /**
     * Prints HTML with meta information for the current post-date/time and author.
     */
    function river_radio_posted_on()
    {
        $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')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()));
        $posted_on = sprintf(esc_html_x('%s', 'post date', 'river-radio'), '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>');
        $byline = sprintf(esc_html_x('%s', 'post author', 'river-radio'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>');
        echo '<span class="byline icons"><i class="fa fa-headphones"></i>
 ' . $byline . '</span><span class="posted-on icons"><i class="fa fa-calendar"></i>
' . $posted_on . '</span>';
        // WPCS: XSS OK.
        if ('post' === get_post_type()) {
            $tags_list = get_the_tag_list('', esc_html__(', ', 'river-radio'));
            if ($tags_list) {
                printf('<span class="tags-links icons"><i class="fa fa-music"></i>
' . esc_html__('%1$s', 'river-radio') . '</span>  ', $tags_list);
                // WPCS: XSS OK.
            }
            $categories_list = get_the_category_list(esc_html__(', ', 'river-radio'));
            if ($categories_list && river_radio_categorized_blog()) {
                printf('<span class="cat-links icons"><i class="fa fa-map-marker"></i>
' . esc_html__('%1$s', 'river-radio') . '</span>', $categories_list);
                // WPCS: XSS OK.
            }
        }
    }
コード例 #12
0
 /**
  * Prints HTML with meta information for the current post-date/time and author.
  */
 function impronta_metadata()
 {
     // Hide category and tag text for pages.
     if ('post' === get_post_type()) {
         echo '<p class="metadata">';
         $byline = sprintf(esc_html_x('By %s', 'post author', 'impronta'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span> ');
         echo $byline;
         /* translators: used between list items, there is a space after the comma */
         $categories_list = get_the_category_list(esc_html__(', ', 'impronta'));
         if ($categories_list && impronta_categorized_blog()) {
             printf('<span class="cat-links">' . esc_html_x('on %1$s ', 'on categories', 'impronta') . '</span>', $categories_list);
             // WPCS: XSS OK.
         }
         /* translators: used between list items, there is a space after the comma */
         $tags_list = get_the_tag_list('', esc_html__(', ', 'impronta'));
         if ($tags_list) {
             printf(esc_html__('tagged %1$s', 'impronta'), $tags_list);
             // WPCS: XSS OK.
         }
         if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) {
             if (get_comments_number(get_the_id()) == 0) {
                 echo esc_html__('- ', 'impronta');
             } else {
                 echo esc_html__('with ', 'impronta');
             }
             comments_popup_link(esc_html__('Leave a comment', 'impronta'), esc_html__('1 Comment', 'impronta'), esc_html__('% Comments', 'impronta'));
         }
         if (is_sticky()) {
             echo ' - ' . '<i class="feature-star fa fa-star" data-toggle="tooltip" data-placement="right" title="' . esc_attr__('Featured Post', 'impronta') . '"></i>';
         }
         echo '</p>';
     }
 }
コード例 #13
0
 /**
  * Prints HTML with meta information for the current post-date/time and author.
  */
 function df_posted_on()
 {
     $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
     $time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()));
     $author = __('by', 'dahztheme') . ' ' . sprintf('<span class="author vcard"><a class="url fn n" href="%1$s">%2$s</a></span>', esc_url(get_author_posts_url(get_the_author_meta('ID'))), esc_html(get_the_author()));
     printf('<span class="posted-on">%1$s</span><span class="byline">%2$s</span>', sprintf('<a href="%1$s" rel="bookmark">%2$s</a>', esc_url(get_permalink()), $time_string), $author);
 }
コード例 #14
0
ファイル: extras.php プロジェクト: selinaross/spring-ridge
 /**
  * Prints HTML with meta information for current post: categories, tags, permalink, author, and date.
  *
  * @return void
  */
 function wheels_entry_meta()
 {
     if (is_sticky() && is_home() && !is_paged()) {
         echo '<span class="featured-post">' . __('Sticky', 'wheels') . '</span>';
     }
     if (!has_post_format('link') && 'post' == get_post_type()) {
         wheels_entry_date();
     }
     // Translators: used between list items, there is a space after the comma.
     $categories_list = get_the_category_list(__(', ', 'wheels'));
     if ($categories_list) {
         echo '/<span class="categories-links">' . $categories_list . '</span>';
     }
     // Translators: used between list items, there is a space after the comma.
     $tag_list = get_the_tag_list('', __(', ', 'wheels'));
     if ($tag_list) {
         echo '/<span class="tags-links">' . $tag_list . '</span>';
     }
     // Post author
     if ('post' == get_post_type()) {
         printf('/<span class="author vcard">%1$s <a class="url fn n" href="%2$s" title="%3$s" rel="author">%4$s</a></span>', __('by', 'wheels'), esc_url(get_author_posts_url(get_the_author_meta('ID'))), esc_attr(sprintf(__('View all posts by %s', 'wheels'), get_the_author())), get_the_author());
         $num_comments = get_comments_number();
         // get_comments_number returns only a numeric value
         if ($num_comments == 0) {
         } else {
             if ($num_comments > 1) {
                 $comments = $num_comments . __(' Comments', 'wheels');
             } else {
                 $comments = __('1 Comment', 'wheels');
             }
             echo $write_comments = '/<span class="comments-count"><a href="' . get_comments_link() . '">' . $comments . '</a></span>';
         }
     }
 }
コード例 #15
0
ファイル: frontend.php プロジェクト: rtmzzi/yummMacVersao
 function tokopress_entry_meta()
 {
     // Translators: used between list items, there is a space after the comma.
     $categories_list = get_the_category_list(__(', ', 'tokopress'));
     // Translators: used between list items, there is a space after the comma.
     $tag_list = get_the_tag_list('', __(', ', 'tokopress'));
     $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(get_the_time()), esc_attr(get_the_date('c')), esc_html(get_the_date()));
     $author = sprintf('<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>', esc_url(get_author_posts_url(get_the_author_meta('ID'))), esc_attr(sprintf(__('View all posts by %s', 'tokopress'), get_the_author())), get_the_author());
     // Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name.
     if (is_singular()) {
         if ($tag_list) {
             $utility_text = __('<span class="post-date">%3$s</span><span class="post-categories">%1$s</span><span class="post-tags">%2$s</span><span class="post-author"> by %4$s</span>', 'tokopress');
         } elseif ($categories_list) {
             $utility_text = __('<span class="post-date">%3$s</span><span class="post-categories">%1$s</span><span class="post-author"> by %4$s</span>', 'tokopress');
         } else {
             $utility_text = __('<span class="post-date">%3$s</span><span class="post-author"> by %4$s</span>', 'tokopress');
         }
     } else {
         if ($categories_list) {
             $utility_text = __('<span class="post-date">%3$s</span><span class="post-categories">%1$s</span><span class="post-author"> by %4$s</span>', 'tokopress');
         } else {
             $utility_text = __('<span class="post-date">%3$s</span><span class="by-author"> by %4$s</span>', 'tokopress');
         }
     }
     printf($utility_text, $categories_list, $tag_list, $date, $author);
 }
コード例 #16
0
/**
 * Page titles
 */
function pinnacle_title()
{
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            return get_the_title(get_option('page_for_posts', true));
        } else {
            return __('Latest Posts', 'pinnacle');
        }
    } elseif (is_archive()) {
        $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
        if ($term) {
            return $term->name;
        } elseif (is_post_type_archive()) {
            return get_queried_object()->labels->name;
        } elseif (is_day()) {
            return sprintf(__('Daily Archives: %s', 'pinnacle'), get_the_date());
        } elseif (is_month()) {
            return sprintf(__('Monthly Archives: %s', 'pinnacle'), get_the_date('F Y'));
        } elseif (is_year()) {
            return sprintf(__('Yearly Archives: %s', 'pinnacle'), get_the_date('Y'));
        } elseif (is_author()) {
            return sprintf(__('Author Archives: %s', 'pinnacle'), get_the_author());
        } else {
            return single_cat_title("", false);
        }
    } elseif (is_search()) {
        return sprintf(__('Search Results for %s', 'pinnacle'), get_search_query());
    } elseif (is_404()) {
        return __('Not Found', 'pinnacle');
    } else {
        return get_the_title();
    }
}
コード例 #17
0
 /**
  * Prints HTML with meta information for the current post-date/time and author.
  */
 function jkl_index_posted_on()
 {
     $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')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()));
     $byline = sprintf(esc_html('%s'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">@' . esc_html(get_the_author()) . '</a></span>');
     if ('chat' === get_post_format() || 'image' === get_post_format() || 'gallery' === get_post_format() || 'audio' === get_post_format() || 'video' === get_post_format()) {
         $string = ucwords(get_post_format());
         $posted_on = $string . ': <a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>';
     } else {
         $posted_on = sprintf(esc_html_x('Date: %s', 'post date', 'jkl'), '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>');
     }
     $meta_class = is_single() ? 'format-small-meta' : 'meta-content-index';
     echo '<div class="' . $meta_class . '">';
     echo '<span class="posted-on">' . $posted_on . '</span>';
     // WPCS: XSS OK.
     if (is_single()) {
         echo '<span class="byline">' . $byline . '</span>';
         if (!has_post_format('quote')) {
             jkl_better_taxonomy_listing('category', 1);
         }
     }
     echo '</div><!-- .meta-content-index -->';
 }
コード例 #18
0
/**
 * Echo post meta author shortcode.
 *
 * @since 1.0.0
 */
function beans_post_meta_author_shortcode()
{
    beans_output('beans_post_meta_author_prefix', __('By ', 'beans'));
    echo beans_open_markup('beans_post_meta_author', 'a', array('href' => esc_url(get_author_posts_url(get_the_author_meta('ID')))));
    echo beans_output('beans_post_meta_author_text', get_the_author());
    echo beans_close_markup('beans_post_meta_author', 'a');
}
コード例 #19
0
ファイル: social.php プロジェクト: Cywaithaka/WPAN
 function x_google_authorship_meta()
 {
     $author = sprintf('%s', get_the_author());
     $title = sprintf('%s', get_the_title());
     $date = sprintf('<time class="entry-date updated" datetime="%1$s">%2$s</time>', esc_attr(get_the_date('c')), esc_html(get_the_date('m.d.Y')));
     printf('<span class="visually-hidden">%1$s%2$s%3$s</span>', '<span class="author vcard"><span class="fn">' . $author . '</span></span>', '<span class="entry-title">' . $title . '</span>', $date);
 }
コード例 #20
0
ファイル: cs_cause.php プロジェクト: rasyidmujahid/scalar-web
function cause_columns($name)
{
    global $post;
    switch ($name) {
        case 'category':
            $categories = get_the_terms($post->ID, 'cs_cause-category');
            if ($categories != "") {
                $couter_comma = 0;
                foreach ($categories as $category) {
                    echo $category->name;
                    $couter_comma++;
                    if ($couter_comma < count($categories)) {
                        echo ", ";
                    }
                }
            }
            break;
        case 'tag':
            $categories = get_the_terms($post->ID, 'cs_cause-tag');
            if ($categories != "") {
                $couter_comma = 0;
                foreach ($categories as $category) {
                    echo $category->name;
                    $couter_comma++;
                    if ($couter_comma < count($categories)) {
                        echo ", ";
                    }
                }
            }
            break;
        case 'author':
            echo get_the_author();
            break;
    }
}
コード例 #21
0
ファイル: template-tags.php プロジェクト: russtx/tac
    function airballoon_display_postmeta()
    {
        ?>
		
		<span class="meta-date">
		<?php 
        printf('<a href="%1$s" title="%2$s" rel="bookmark"><time datetime="%3$s">%4$s</time></a>', esc_url(get_permalink()), esc_attr(get_the_time()), esc_attr(get_the_date('c')), esc_html(get_the_date()));
        ?>
		</span>
		<span class="meta-author">
		<?php 
        printf('<a href="%1$s" title="%2$s" rel="author">%3$s</a>', esc_url(get_author_posts_url(get_the_author_meta('ID'))), esc_attr(sprintf(__('View all posts by %s', 'airballoon-lite'), get_the_author())), get_the_author());
        ?>
		</span>
		
	<?php 
        if (comments_open()) {
            ?>
			<span class="meta-comments">
				<?php 
            comments_popup_link(__('Leave a comment', 'airballoon-lite'), __('One comment', 'airballoon-lite'), __('% comments', 'airballoon-lite'));
            ?>
			</span>
<?php 
        }
        edit_post_link(__('Edit Post', 'airballoon-lite'));
    }
コード例 #22
0
function fulgent_entry_meta()
{
    $fulgent_category_list = get_the_category_list(', ', ' ');
    $fulgent_tag_list = get_the_tag_list('<li>' . __('Tags : ', 'fulgent'), ', ', ' ' . '</li>');
    $fulgent_date = sprintf('<time datetime="%1$s">%2$s</time>', esc_attr(get_the_date('c')), esc_html(get_the_date()));
    $fulgent_author = sprintf('<a href="%1$s" title="%2$s" >%3$s</a>', esc_url(get_author_posts_url(get_the_author_meta('ID'))), esc_attr(sprintf(__('View all posts by %s', 'fulgent'), get_the_author())), get_the_author());
    if ($fulgent_tag_list) {
        $fulgent_utility_text = '<div class="post-meta"><ul>
			<li> ' . __('by', 'fulgent') . ' : %4$s </li>	
			<li>' . __('Posted in', 'fulgent') . ' : %1$s </li>
			%2$s 
			<li> ' . fulgent_comment_number_custom() . '</li>
			</ul>
		</div>';
    } elseif ($fulgent_category_list) {
        $fulgent_utility_text = '<div class="post-meta"><ul>
			<li>' . __('by', 'fulgent') . ' : %4$s</li>
			<li>' . __('Posted in', 'fulgent') . ' : %1$s </li>
			 %2$s  
			<li>' . fulgent_comment_number_custom() . '</li>
			</ul>
		</div>';
    } else {
        $fulgent_utility_text = '<div class="post-meta"><ul>
			<li>' . __('by', 'fulgent') . ' : %4$s </li>
			<li>' . __('Posted on', 'fulgent') . ' : %3$s </li>
			 %2$s 
			<li>' . fulgent_comment_number_custom() . '</li>
			</ul>
		</div>';
    }
    printf($fulgent_utility_text, $fulgent_category_list, $fulgent_tag_list, $fulgent_date, $fulgent_author);
}
コード例 #23
0
ファイル: template-tags.php プロジェクト: nbeecroft/roots
function roots_entry_meta()
{
    echo '<div id="author-info">';
    echo '<time class="updated" datetime="' . get_the_time('c') . '" pubdate>' . sprintf(__('Posted on %s at %s.', 'roots'), get_the_date(), get_the_time()) . '</time>';
    echo '<p class="byline author vcard">' . __('Written by', 'roots') . ' <a href="' . get_author_posts_url(get_the_author_meta('id')) . '" rel="author" class="fn">' . get_the_author() . '</a></p>';
    echo '</div>';
}
コード例 #24
0
function twentyten_posted_on()
{
    $meta = array();
    $meta['author'] = sprintf(__('%1$s <span class="meta-sep">by</span> %2$s', 'wordcampbase'), sprintf('<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>', get_permalink(), esc_attr(get_the_time()), get_the_date()), sprintf('<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>', get_author_posts_url(get_the_author_meta('ID')), sprintf(esc_attr__('View all posts by %s', 'wordcampbase'), get_the_author()), get_the_author()));
    $meta['sep'] = ' <span class="meta-sep meta-sep-bull">&bull;</span> ';
    $meta['comments'] = array('before' => '<span class="comments-link">', 'after' => '</span>', 'zero' => __('Leave a comment', 'wordcampbase'), 'one' => __('1 Comment', 'wordcampbase'), 'many' => __('% Comments', 'wordcampbase'));
    $meta['edit'] = array('title' => __('Edit', 'wordcampbase'), 'before' => '<span class="edit-link">', 'after' => '</span>');
    $meta['br'] = '<br />';
    // Just to have.
    $meta['order'] = array('author', 'sep', 'comments', 'edit');
    $meta = apply_filters('wcb_entry_meta', $meta);
    if (!is_array($meta) || !isset($meta['order'])) {
        return;
    }
    foreach ($meta['order'] as $type) {
        $content = $meta[$type];
        switch ($type) {
            case 'comments':
                echo $content['before'];
                comments_popup_link($content['zero'], $content['one'], $content['many']);
                echo $content['after'];
                break;
            case 'edit':
                if (isset($meta['sep'])) {
                    $content['before'] = $meta['sep'] . $content['before'];
                }
                edit_post_link($content['title'], $content['before'], $content['after']);
                break;
            default:
                echo $content;
        }
    }
}
コード例 #25
0
/**
 * Render Wish List Columns
 *
 * @since 1.0
 * @param string $column_name Column name
 * @param int $post_id Download (Post) ID
 * @return void
 */
function edd_wl_render_admin_columns($column_name, $post_id)
{
    if (get_post_type($post_id) == 'edd_wish_list') {
        $items = get_post_meta(get_the_ID(), 'edd_wish_list', true);
        switch ($column_name) {
            case 'downloads':
                if ($items) {
                    echo count($items);
                } else {
                    echo 0;
                }
                break;
            case 'total':
                echo edd_wl_get_list_total(get_the_ID());
                break;
            case 'list_author':
                $post = get_post();
                if (0 == $post->post_author) {
                    echo __('Guest', 'edd-wish-lists');
                } else {
                    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());
                }
                break;
        }
    }
}
コード例 #26
0
function the_author($idmode = '', $echo = true)
{
    if ($echo) {
        echo get_the_author($idmode);
    }
    return get_the_author($idmode);
}
コード例 #27
0
 function thirdrail_entry_meta()
 {
     echo '<div class="entry-meta">';
     echo '<p class="byline"><a href="' . get_author_posts_url(get_the_author_meta('ID')) . '" rel="author" class="author">' . get_the_author() . '</a>' . cats() . '</p>';
     echo '<time class="updated date" datetime="' . get_the_time('c') . '">' . sprintf(__('%s', 'thirdrail'), get_the_date()) . '</time>';
     echo '</div>';
 }
コード例 #28
0
 /**
  * adds user's twitter profile link to their bio, wherever it is displayed
  *
  * @since   0.0.1
  * @param   string  $description
  * @return  string  $description + twitter link
  */
 function add_twitter_link_to_bio($description)
 {
     // this should normalize most instances of full or partial url, @username, etc., to username only
     $username = preg_replace('#https?://|twitter.com/|@#', '', get_the_author_meta('twitter'));
     if (!$username) {
         // return early if no twitter username
         return $description;
     }
     // build twitter URL from username
     $href = 'https://twitter.com/' . $username;
     // link title, translated: 'Follow (Author Name) on Twitter'
     $title = esc_attr(sprintf(__('Follow %s on Twitter'), get_the_author()));
     /**
      * if genericons is enqueued, let's add a twitter icon! for fun.
      *
      * trying to be as design-agnostic as possible here, but genericons are by
      * default given font-size: 16px; i'd rather make that 1em, since this use
      * is inline w text, at different sizes throughout the theme
      */
     $icon = wp_style_is('genericons') ? '<i class="genericon genericon-twitter" style="font-size:inherit;line-height:inherit"></i>' : '';
     // that WAS fun
     /**
      * build output.
      * still trying to be unopinionated but also would like for it to look good
      * out of the box, and inserting a couple of spaces matches the output of
      * twentyfifteen's other author links looks p good to me
      */
     $twitter_link = sprintf(' <a class="author-link twitter-link" href="%s" title="%s">%s @%s </a>', $href, $title, $icon, $username);
     // finally, return
     return $description . $twitter_link;
 }
コード例 #29
0
 /**
  * Prints HTML with meta information for the current post-date/time, author, comment count and categories.
  */
 function ultra_posted_on()
 {
     echo '<div class="entry-meta-inner">';
     if (is_sticky() && is_home() && !is_paged()) {
         echo '<span class="featured-post">' . __('Sticky', 'ultra') . '</span>';
     }
     if (is_home() && siteorigin_setting('blog_post_date') || is_archive() && siteorigin_setting('blog_post_date') || is_search() && siteorigin_setting('blog_post_date')) {
         echo '<span class="entry-date"><a href="' . esc_url(get_permalink()) . '" rel="bookmark"><time class="published" datetime="' . esc_attr(get_the_date('c')) . '">' . esc_html(get_the_date('j F Y')) . '</time><time class="updated" datetime="' . esc_attr(get_the_modified_date('c')) . '">' . esc_html(get_the_modified_date()) . '</time></span></a>';
     }
     if (is_single() && siteorigin_setting('blog_post_date')) {
         echo '<span class="entry-date"><time class="published" datetime="' . esc_attr(get_the_date('c')) . '">' . esc_html(get_the_date('j F Y')) . '</time><time class="updated" datetime="' . esc_attr(get_the_modified_date('c')) . '">' . esc_html(get_the_modified_date()) . '</time></span>';
     }
     if (siteorigin_setting('blog_post_author')) {
         echo '<span class="byline"><span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '" rel="author">' . esc_html(get_the_author()) . '</a></span></span>';
     }
     if (comments_open() && siteorigin_setting('blog_post_comment_count')) {
         echo '<span class="comments-link">';
         comments_popup_link(__('Leave a comment', 'ultra'), __('1 Comment', 'ultra'), __('% Comments', 'ultra'));
         echo '</span>';
     }
     echo '</div>';
     if (is_single() && siteorigin_setting('navigation_post_nav')) {
         the_post_navigation($args = array('prev_text' => '', 'next_text' => ''));
     }
 }
コード例 #30
0
 /**
  * Prints HTML with meta information for the current post-date/time and author.
  */
 function pleiadesweb_posted_on()
 {
     // POSTED ON
     $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')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()));
     $posted_on = sprintf('<i class="fa fa-calendar"></i>' . esc_html_x(' %s', 'post date', 'pleiadesweb'), '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>');
     // AUTHOR
     $byline = sprintf(esc_html_x('| escrito por %s', 'post author', 'pleiadesweb'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>');
     echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>';
     // CATEGORIES
     /* translators: used between list items, there is a space after the comma */
     $categories_list = get_the_category_list(esc_html__(', ', 'pleiadesweb'));
     if ($categories_list && pleiadesweb_categorized_blog()) {
         echo ' | </i><span class="category-list">' . $categories_list . '</span>';
     }
     // COMMENTS
     if (!post_password_required() && (comments_open() || '0' != get_comments_number())) {
         echo ' | <span class="comments-link">';
         comments_popup_link(__('Deja un comentario', 'my-simone'), __('1 comentario', 'my-simone'), __('% comentarios', 'my-simone'));
         echo '</span>';
     }
     //!post_password_required()
 }