php - wordpress blog title url -
i'm trying make blog titles link full post preview area title should have same function read more button. blogs in masonry layout , i'm using themeforest theme.
this blog page.
i believe php code controls layout - hope helps.
sorry php newbie here.
i have tried using <a href="'.get_permalink().'"><h5 class="post-title">'. get_the_title() .'</h5></a>';
did generate broken url containing '.get_permalink().'" in it.
thank you
<?php if ( '' != get_the_title() ): ?> <h5 class="post-title"><?php the_title(); ?></h5> <?php endif ?> <?php if (has_post_format('link')): ?> <a href="<?php echo $nz_link_url; ?>" title="<?php echo __("go to", tempname).' '.$nz_link_url; ?>" target="_blank"><?php echo __("read more", tempname); ?><span class="icon-arrow-right9"></span></a> <?php else: ?> <a href="<?php the_permalink(); ?>" title="<?php echo __("read more about", tempname).' '.get_the_title(); ?>" rel="bookmark"><?php echo __("read more", tempname); ?><span class="icon-arrow-right9"></span></a> <?php endif ?> <?php endif; ?>
you need wrap h5 title in anchor tag <a>
on line 37 of snippet. specific code change is:
new answer
<a href="<?php get_permalink(); ?>"> <h5 class="post-title"><?php the_title(); ?></h5> </a>
or code, try:
<a href="<?php echo $nz_link_url; ?>" title="<?php echo __("go to", tempname).' '.$nz_link_url; ?>"> <h5 class="post-title"><?php the_title(); ?></h5> </a>
old answer
if ( '' != get_the_title() ){ $output .= '<a href="'.get_permalink().'"><h5 class="post-title">'. get_the_title() .'</h5></a>'; }
you may have update css reflect anchor tag in front of h5
full code
while($recent_posts->have_posts()) : $recent_posts->the_post(); $output .= '<div class="post format-'.get_post_format().'" data-grid="ninzio_01">'; $output .= '<div class="post-wrap nz-clearfix">'; if (get_post_format() == 'image') { $values = get_post_custom( $post->id ); $nz_image_url = isset($values["image_url"][0]) ? $values["image_url"][0] : ""; if (!empty($nz_image_url)) { $output .='<a class="nz-more" href="'.get_permalink().'">'; $output .= '<div class="nz-thumbnail">'; $output .= '<img src="'.$nz_image_url.'" alt="'.get_the_title().'">'; $output .= '<div class="ninzio-overlay"></div>'; $output .= '<div class="post-date"><span>'.get_the_date("d").'</span><span>'.get_the_date("m").'</span></div>'; $output .='</div>'; $output .='</a>'; } } else { if (has_post_thumbnail()) { $output .='<a class="nz-more" href="'.get_permalink().'">'; $output .= '<div class="nz-thumbnail">'; $output .= get_the_post_thumbnail( $post->id, $size ); $output .= '<div class="ninzio-overlay"></div>'; $output .= '<div class="post-date"><span>'.get_the_date("d").'</span><span>'.get_the_date("m").'</span></div>'; $output .='</div>'; $output .='</a>'; } } $output .= '<div class="post-body">'; if ( '' != get_the_title() ){ $output .= '<a href="'.get_permalink().'"><h5 class="post-title">'. get_the_title() .'</h5></a>'; } if ($excerpt == "true") { $output .= '<div class="post-excerpt">'.nz_excerpt(95).'</div>'; } $output .='<a href="'.get_permalink().'" title="'.__("read more about", tempname).' '.get_the_title().'" rel="bookmark">'.__("read more", tempname).' <span class="icon-arrow-right9"></span></a>'; $output .= '</div>'; $output .= '</div>'; $output .= '</div>';
Comments
Post a Comment