Merge pull request #57 from tainacan/fix/show_navegation_thumbs
fix: test if `previous_thumb` and `next_thumb` exists
This commit is contained in:
commit
2269ac5976
|
@ -169,10 +169,10 @@ function tainacan_get_adjacent_item_links($thumbnail = null) {
|
||||||
//Get the thumnail url of the previous and next post
|
//Get the thumnail url of the previous and next post
|
||||||
if (function_exists('tainacan_get_adjacent_items') && isset($_GET['pos'])) {
|
if (function_exists('tainacan_get_adjacent_items') && isset($_GET['pos'])) {
|
||||||
if ($adjacent_items['next']) {
|
if ($adjacent_items['next']) {
|
||||||
$next_thumb = $adjacent_items['next']['thumbnail']['tainacan-small'][0];
|
$next_thumb = isset($adjacent_items['next']['thumbnail']['tainacan-small'][0]) ? $adjacent_items['next']['thumbnail']['tainacan-small'][0] : false;
|
||||||
}
|
}
|
||||||
if ($adjacent_items['previous']) {
|
if ($adjacent_items['previous']) {
|
||||||
$previous_thumb = $adjacent_items['previous']['thumbnail']['tainacan-small'][0];
|
$previous_thumb = isset($adjacent_items['previous']['thumbnail']['tainacan-small'][0]) ? $adjacent_items['previous']['thumbnail']['tainacan-small'][0] : false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$previous_thumb = get_the_post_thumbnail_url( get_previous_post(), 'tainacan-small' );
|
$previous_thumb = get_the_post_thumbnail_url( get_previous_post(), 'tainacan-small' );
|
||||||
|
@ -183,11 +183,13 @@ function tainacan_get_adjacent_item_links($thumbnail = null) {
|
||||||
$previous = $previous_link_url === false ? '' :
|
$previous = $previous_link_url === false ? '' :
|
||||||
'<a class="has-small-thumbnail" rel="prev" href="' . $previous_link_url . '">' .
|
'<a class="has-small-thumbnail" rel="prev" href="' . $previous_link_url . '">' .
|
||||||
'<i class="tainacan-icon tainacan-icon-arrowleft tainacan-icon-30px"></i> <span>' .
|
'<i class="tainacan-icon tainacan-icon-arrowleft tainacan-icon-30px"></i> <span>' .
|
||||||
$previous_title . '</span><img src="' . $previous_thumb . '" alt="">' .
|
$previous_title . '</span>' .
|
||||||
|
($previous_thumb !== false ? '<img src="' . $previous_thumb . '" alt="" />' : '') .
|
||||||
'</a>';
|
'</a>';
|
||||||
$next = $next_link_url === false ? '' :
|
$next = $next_link_url === false ? '' :
|
||||||
'<a class="has-small-thumbnail" rel="next" href="' . $next_link_url . '">' .
|
'<a class="has-small-thumbnail" rel="next" href="' . $next_link_url . '">' .
|
||||||
'<img src="' . $next_thumb . '" alt=""><span>' . $next_title .
|
($next_thumb !== false ? '<img src="' . $next_thumb . '" alt="" />' : '') .
|
||||||
|
'<span>' . $next_title .
|
||||||
'</span> <i class="tainacan-icon tainacan-icon-arrowright tainacan-icon-30px"></i>' .
|
'</span> <i class="tainacan-icon tainacan-icon-arrowright tainacan-icon-30px"></i>' .
|
||||||
'</a>';
|
'</a>';
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue