the_title_attribute(). Props Nazgul. fixes #4731
git-svn-id: http://svn.automattic.com/wordpress/trunk@6132 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
dbd3d07274
commit
1fa2f6df66
|
@ -29,7 +29,7 @@
|
|||
|
||||
<?php while (have_posts()) : the_post(); ?>
|
||||
<div class="post">
|
||||
<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
|
||||
<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
|
||||
<small><?php the_time('l, F jS, Y') ?></small>
|
||||
|
||||
<div class="entry">
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<?php $attachment_link = get_the_attachment_link($post->ID, true, array(450, 800)); // This also populates the iconsize for the next line ?>
|
||||
<?php $_post = &get_post($post->ID); $classname = ($_post->iconsize[0] <= 128 ? 'small' : '') . 'attachment'; // This lets us style narrow icons specially ?>
|
||||
<div class="post" id="post-<?php the_ID(); ?>">
|
||||
<h2><a href="<?php echo get_permalink($post->post_parent); ?>" rev="attachment"><?php echo get_the_title($post->post_parent); ?></a> » <a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h2>
|
||||
<h2><a href="<?php echo get_permalink($post->post_parent); ?>" rev="attachment"><?php echo get_the_title($post->post_parent); ?></a> » <a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
|
||||
<div class="entry">
|
||||
<p class="<?php echo $classname; ?>"><?php echo $attachment_link; ?><br /><?php echo basename($post->guid); ?></p>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<?php while (have_posts()) : the_post(); ?>
|
||||
|
||||
<div class="post" id="post-<?php the_ID(); ?>">
|
||||
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
|
||||
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
|
||||
<small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
|
||||
|
||||
<div class="entry">
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<?php while (have_posts()) : the_post(); ?>
|
||||
|
||||
<div class="post">
|
||||
<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
|
||||
<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
|
||||
<small><?php the_time('l, F jS, Y') ?></small>
|
||||
|
||||
<p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
</div>
|
||||
|
||||
<div class="post" id="post-<?php the_ID(); ?>">
|
||||
<h2><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h2>
|
||||
<h2><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
|
||||
|
||||
<div class="entry">
|
||||
<?php the_content('<p class="serif">Read the rest of this entry »</p>'); ?>
|
||||
|
|
|
@ -19,7 +19,7 @@ function get_the_ID() {
|
|||
function the_title($before = '', $after = '', $echo = true) {
|
||||
$title = get_the_title();
|
||||
|
||||
if ( strlen($title) <= 0 )
|
||||
if ( strlen($title) == 0 )
|
||||
return;
|
||||
|
||||
$title = $before . $title . $after;
|
||||
|
@ -30,6 +30,25 @@ function the_title($before = '', $after = '', $echo = true) {
|
|||
return $title;
|
||||
}
|
||||
|
||||
function the_title_attribute( $args = '' ) {
|
||||
$title = get_the_title();
|
||||
|
||||
if ( strlen($title) == 0 )
|
||||
return;
|
||||
|
||||
$defaults = array('before' => '', 'after' => '', 'echo' => true);
|
||||
$r = wp_parse_args($args, $defaults);
|
||||
extract( $r, EXTR_SKIP );
|
||||
|
||||
|
||||
$title = $before . $title . $after;
|
||||
$title = attribute_escape(strip_tags($title));
|
||||
|
||||
if ( $echo )
|
||||
echo $title;
|
||||
else
|
||||
return $title;
|
||||
}
|
||||
|
||||
function get_the_title( $id = 0 ) {
|
||||
$post = &get_post($id);
|
||||
|
|
Loading…
Reference in New Issue