Maryke
|
The code for showing previous / next post is the following in the single.php
'next_link' => theme_get_previous_post_link('« %link'),
'prev_link' => theme_get_next_post_link('%link »')
What I want is the following
1. I want to add the thumbnail of the previous / next post
2. I only want to show previous / next post from the same category
Can someone please help me with this?
Thank you in advance.
Link to the site: http://designsbyodette.co.za/
|
|
Maryke
|
Pretty Please can someone help me?
|
|
webguygary
|
try this:
http://www.wpbeginner.com/wp-themes/how-to-use-thumbnails-with-previous-and-next-post-links-in-wordpress/
|
|
Abland
|
Hi, Maryke,
Quote Maryke:2. I only want to show previous / next post from the same category
For Artisteer 3.0 in your theme's "functions.php" find approximately line 414:
if (!function_exists('theme_get_previous_post_link')){
function theme_get_previous_post_link($format='« %link', $link='%title', $in_same_cat = false, $excluded_categories = '') {
return theme_get_adjacent_post_link($format, $link, $in_same_cat, $excluded_categories, true);
}
}
if (!function_exists('theme_get_next_post_link')){
function theme_get_next_post_link($format='%link »', $link='%title', $in_same_cat = false, $excluded_categories = '') {
return theme_get_adjacent_post_link($format, $link, $in_same_cat, $excluded_categories, false);
}
}
Change both instances of "$in_same_cat = false" to "$in_same_cat = true":
if (!function_exists('theme_get_previous_post_link')){
function theme_get_previous_post_link($format='« %link', $link='%title', $in_same_cat = true, $excluded_categories = '') {
return theme_get_adjacent_post_link($format, $link, $in_same_cat, $excluded_categories, true);
}
}
if (!function_exists('theme_get_next_post_link')){
function theme_get_next_post_link($format='%link »', $link='%title', $in_same_cat = true, $excluded_categories = '') {
return theme_get_adjacent_post_link($format, $link, $in_same_cat, $excluded_categories, false);
}
}
|
|
speedy
|
Seems years since I've had to hack artisteer code, but Abland saves the day yet again - give that guy a meddle :)
Quote Abland:
Hi, Maryke,
Quote Maryke:2. I only want to show previous / next post from the same category
For Artisteer 3.0 in your theme's "functions.php" find approximately line 414:
if (!function_exists('theme_get_previous_post_link')){
function theme_get_previous_post_link($format='« %link', $link='%title', $in_same_cat = false, $excluded_categories = '') {
return theme_get_adjacent_post_link($format, $link, $in_same_cat, $excluded_categories, true);
}
}
if (!function_exists('theme_get_next_post_link')){
function theme_get_next_post_link($format='%link »', $link='%title', $in_same_cat = false, $excluded_categories = '') {
return theme_get_adjacent_post_link($format, $link, $in_same_cat, $excluded_categories, false);
}
}
Change both instances of "$in_same_cat = false" to "$in_same_cat = true":
if (!function_exists('theme_get_previous_post_link')){
function theme_get_previous_post_link($format='« %link', $link='%title', $in_same_cat = true, $excluded_categories = '') {
return theme_get_adjacent_post_link($format, $link, $in_same_cat, $excluded_categories, true);
}
}
if (!function_exists('theme_get_next_post_link')){
function theme_get_next_post_link($format='%link »', $link='%title', $in_same_cat = true, $excluded_categories = '') {
return theme_get_adjacent_post_link($format, $link, $in_same_cat, $excluded_categories, false);
}
}
|
|
|
|