Skip to content

Commit

Permalink
Added separate file for template tags.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rarst committed Jan 10, 2014
1 parent 894f473 commit 4145ac6
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 54 deletions.
56 changes: 2 additions & 54 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace DevHub;

require __DIR__ . '/template-tags.php';

add_action( 'init', __NAMESPACE__ . '\\init' );


Expand Down Expand Up @@ -131,57 +133,3 @@ function theme_scripts_styles() {

## wp_enqueue_script( 'ace-editor', 'http://rawgithub.com/ajaxorg/ace-builds/master/src-noconflict/ace.js' );
}

function wp_doc_comment( $comment, $args, $depth ) {
?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
<article id="comment-<?php comment_ID(); ?>" class="comment">

<?php if ( $comment->comment_approved == '0' ) : ?>
<em class="comment-awaiting-moderation"><?php _e( 'Your example is awaiting moderation.', 'wporg' ); ?></em>
<br />
<?php endif; ?>

<pre class="example-content"><?php echo htmlentities( get_comment_text() ); ?></pre>

<footer class="comment-meta">
<div class="comment-author vcard">
<?php
echo get_avatar( $comment );

/* translators: 1: comment author, 2: date and time */
printf( __( 'Contributed by %1$s on %2$s', 'wporg' ),
sprintf( '<span class="fn">%s</span>', get_comment_author_link() ),
sprintf( '<a href="%1$s"><time datetime="%2$s">%3$s</time></a>',
esc_url( get_comment_link( $comment->comment_ID ) ),
get_comment_time( 'c' ),
/* translators: 1: date, 2: time */
sprintf( __( '%1$s at %2$s', 'wporg' ), get_comment_date(), get_comment_time() )
)
);
?>

<?php edit_comment_link( __( 'Edit', 'wporg' ), '<span class="edit-link">', '</span>' ); ?>
</div><!-- .comment-author .vcard -->

</footer>

</article><!-- #comment-## -->

<?php
}

/**
* Get current (latest) since version
*
* @return object
*/
function get_current_version() {

$version = get_terms( 'wpapi-since', array(
'number' => '1',
'order' => 'DESC',
) );

return $version[0];
}
57 changes: 57 additions & 0 deletions template-tags.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php

function wp_doc_comment( $comment, $args, $depth ) {
?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
<article id="comment-<?php comment_ID(); ?>" class="comment">

<?php if ( $comment->comment_approved == '0' ) : ?>
<em class="comment-awaiting-moderation"><?php _e( 'Your example is awaiting moderation.', 'wporg' ); ?></em>
<br />
<?php endif; ?>

<pre class="example-content"><?php echo htmlentities( get_comment_text() ); ?></pre>

<footer class="comment-meta">
<div class="comment-author vcard">
<?php
echo get_avatar( $comment );

/* translators: 1: comment author, 2: date and time */
printf( __( 'Contributed by %1$s on %2$s', 'wporg' ),
sprintf( '<span class="fn">%s</span>', get_comment_author_link() ),
sprintf( '<a href="%1$s"><time datetime="%2$s">%3$s</time></a>',
esc_url( get_comment_link( $comment->comment_ID ) ),
get_comment_time( 'c' ),
/* translators: 1: date, 2: time */
sprintf( __( '%1$s at %2$s', 'wporg' ), get_comment_date(), get_comment_time() )
)
);
?>

<?php edit_comment_link( __( 'Edit', 'wporg' ), '<span class="edit-link">', '</span>' ); ?>
</div>
<!-- .comment-author .vcard -->

</footer>

</article>
<!-- #comment-## -->

<?php
}

/**
* Get current (latest) since version
*
* @return object
*/
function get_current_version() {

$version = get_terms( 'wpapi-since', array(
'number' => '1',
'order' => 'DESC',
) );

return $version[0];
}

0 comments on commit 4145ac6

Please sign in to comment.