PageRenderTime 44ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/themes/esquire/content-link.php

https://github.com/Bochet/festival_lgbt
PHP | 75 lines | 49 code | 11 blank | 15 comment | 8 complexity | faa448d946896f5b9c9dea4d6cbc5867 MD5 | raw file
Possible License(s): GPL-2.0, AGPL-1.0, LGPL-2.1
  1. <?php
  2. /**
  3. * The default template for displaying content
  4. *
  5. * @package Esquire
  6. * @since Esquire 1.0
  7. */
  8. ?>
  9. <div <?php post_class(); ?>>
  10. <?php if ( ! is_page() ) : ?>
  11. <div class="datebox">
  12. <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'esquire' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark">
  13. <p class="day"><?php the_time( 'd' ); ?></p>
  14. <p class="month"><?php the_time( 'M' ); ?></p>
  15. </a>
  16. </div>
  17. <?php endif; ?>
  18. <div class="postbody link">
  19. <?php
  20. // Let's get all the post content
  21. $link_content = $post->post_content;
  22. // And let's find the first url in the post content
  23. $link_url = esquire_url_grabber();
  24. // Let's make the title a link if there's a link in this link post
  25. if ( ! empty( $link_url ) ) :
  26. ?>
  27. <h1 class="entry-title"><a href="<?php echo $link_url; ?>"><?php the_title(); ?></a></h1>
  28. <?php else : ?>
  29. <h1 class="entry-title"><?php the_title(); ?></h1>
  30. <?php endif; ?>
  31. <?php
  32. // Sometimes links need descriptions and sometimes they don't ...
  33. // Let's compare the length of the first url with the length of the post content.
  34. // If they're one and the same we don't really need to show the post content BECAUSE ...
  35. // that's just a url and we're already using that url as a href for the title link above BUT ...
  36. // if they're NOT the same I think we should show that content.
  37. if ( strlen( $link_url ) != strlen( $link_content ) ) :
  38. // Let's make any bare URL a clickable link, too.
  39. add_filter( 'the_content', 'make_clickable' );
  40. ?>
  41. <div class="content">
  42. <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'esquire' ) ); ?>
  43. <?php wp_link_pages( array( 'before' => '<p class="page-link"><span>' . __( 'Pages:', 'esquire' ) . '</span>', 'after' => '</p>' ) ); ?>
  44. </div>
  45. <?php endif; ?>
  46. <?php comments_template( '', true ); ?>
  47. <div class="meta bar">
  48. <p class="permalink">
  49. <?php if ( ! is_page() ) : ?>
  50. <a href="<?php the_permalink(); ?>"><span rel="<?php the_time( get_option( 'date_format' ) ); ?>"><?php printf( __( '%1$s ago', 'esquire' ), human_time_diff( get_the_time( 'U' ), current_time( 'timestamp' ) ) ); ?></span></a>
  51. <?php endif; ?>
  52. <a href="<?php echo wp_get_shortlink(); ?> " class="shorturl"><span><?php _e( 'Short URL', 'esquire' ); ?></span></a>
  53. <?php comments_popup_link( '<span>' . __( 'Comments', 'esquire' ) . '</span>', '<span>' . __( '1 Comment', 'esquire' ) . '</span>', '<span>' . __( '% Comments', 'esquire' ) . '</span>', 'comment-count', '' ); ?>
  54. <?php edit_post_link( __( 'Edit', 'esquire' ) ); ?>
  55. </p>
  56. <div class="tagbar">
  57. <?php if ( 1 != esquire_category_counter() ) : ?>
  58. <p class="tags cats"><?php the_category( '<span>/</span>' ); ?></p>
  59. <?php endif; ?>
  60. <?php the_tags( '<p class="tags">', '<span>/</span>', '</p>' ); ?>
  61. </div><!-- .tagbar -->
  62. </div><!-- .meta .bar -->
  63. </div><!-- .postbody .text -->
  64. </div><!-- .post -->