Advertisement
Guest User

Untitled

a guest
Oct 31st, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.95 KB | None | 0 0
  1. /**
  2. * Prints HTML with meta information for the current post-date/time and author.
  3. *
  4. * @return string
  5. */
  6. if ( ! function_exists( 'jas_gecko_posted_on' ) ) {
  7. function jas_gecko_posted_on() {
  8. $output = '';
  9. $time = '<a class="cg" href="%3$s"><time class="entry-date published updated" datetime="%1$s" ' . jas_gecko_schema_metadata( array( 'context' => 'entry_time', 'echo' => false ) ) . '>%2$s</time></a>';
  10.  
  11. $output .= sprintf( $time,
  12. esc_attr( get_the_date( 'c' ) ),
  13. esc_html( get_the_date() ),
  14. esc_url( get_permalink() )
  15. );
  16.  
  17. echo apply_filters( 'jas_gecko_posted_on', '<span class="posted-on fs__12">' . $output . '</span>' );
  18. }
  19. }
  20.  
  21. /**
  22. * Prints post title.
  23. *
  24. * @return string
  25. */
  26. if ( ! function_exists( 'jas_gecko_post_title' ) ) {
  27. function jas_gecko_post_title( $link = true ) {
  28. $output = '';
  29.  
  30. if ( $link ) {
  31. $output .= sprintf( '<h2 class="post-title fs__14 ls__2 mt__10 mb__5 tu" ' . jas_gecko_schema_metadata( array( 'context' => 'entry_title', 'echo' => false ) ) . '><a class="chp" href="%2$s" rel="bookmark">%1$s</a></h2>', get_the_title(), esc_url( get_permalink() ) );
  32. } else {
  33. $output .= sprintf( '<h2 class="post-title fs__14 ls__2 tu" ' . jas_gecko_schema_metadata( array( 'context' => 'entry_title', 'echo' => false ) ) . '>%s</h2>', get_the_title() );
  34. }
  35.  
  36. echo apply_filters( 'jas_gecko_post_title', $output );
  37. }
  38. }
  39.  
  40. /**
  41. * Prints post meta with the post author, categories and post comments.
  42. *
  43. * @return string
  44. */
  45. if ( ! function_exists( 'jas_gecko_post_meta' ) ) {
  46. function jas_gecko_post_meta() {
  47. $output = '';
  48. // Post author
  49. $output .= sprintf(
  50. esc_html__( '%1$s', 'gecko' ),
  51. '<span class="author vcard pr" ' . jas_gecko_schema_metadata( array( 'context' => 'author', 'echo' => false ) ) . '>' . esc_html__( 'By ', 'gecko' ) . '<a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
  52. );
  53.  
  54. // Post categories
  55. $categories = get_the_category_list( esc_html__( ', ', 'gecko' ) );
  56. if ( $categories ) {
  57. $output .= sprintf(
  58. '<span class="cat pr">' . esc_html__( 'In %1$s', 'gecko' ) . '</span>', $categories
  59. );
  60. }
  61.  
  62. // Post comments
  63. if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
  64. $output .= sprintf( '<span class="comment-number pr"><a href="%2$s">' . esc_html__( '%1$s Comment', get_comments_number(), 'gecko' ) . '</a></span>', number_format_i18n( get_comments_number() ), get_comments_link() );
  65. }
  66.  
  67. echo apply_filters( 'jas_gecko_post_meta', '<div class="post-meta fs__12">' . $output . '</div>' );
  68. }
  69. }
  70.  
  71. /**
  72. * Render post tags.
  73. *
  74. * @since 1.0.0
  75. */
  76. if ( ! function_exists( 'jas_gecko_get_tags' ) ) :
  77. function jas_gecko_get_tags() {
  78. $output = '';
  79.  
  80. // Get the tag list
  81. $tags_list = get_the_tag_list( '', esc_html__( ', ', 'gecko' ) );
  82. if ( $tags_list ) {
  83. $output .= sprintf( '<div class="post-tags"><i class="fa fa-tags"></i> ' . esc_html__( '%1$s', 'gecko' ) . '</div>', $tags_list );
  84. }
  85. return apply_filters( 'jas_gecko_get_tags', $output );
  86. }
  87. endif;
  88.  
  89. /**
  90. * Display an optional post thumbnail.
  91. *
  92. * Wraps the post thumbnail in an anchor element on index views, or a div
  93. * element when on single views.
  94. *
  95. * @return string
  96. */
  97. if ( ! function_exists( 'jas_gecko_post_thumbnail' ) ) {
  98. function jas_gecko_post_thumbnail() {
  99. if ( post_password_required() || is_attachment() ) {
  100. return;
  101. }
  102. ?>
  103. <div class="post-thumbnail pr mb__25">
  104. <?php if ( has_post_thumbnail() ) : ?>
  105. <a href="<?php esc_url( the_permalink() ); ?>" aria-hidden="true">
  106. <?php the_post_thumbnail( 'post-thumbnail', array( 'alt' => get_the_title() ) ); ?>
  107. </a>
  108. <?php endif; ?>
  109. <div class="pa inside-thumb tc cg">
  110. <?php jas_gecko_post_meta(); ?>
  111. <?php jas_gecko_post_title(); ?>
  112. <?php jas_gecko_posted_on(); ?>
  113. </div>
  114. </div>
  115. <?php
  116. }
  117. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement