Hello,
I’m struggling with my own shortcode to display something on an smart list page. It’s displayed on every smart list page and not on the page/position where the shortcode is placed.
E.g. Shortcode [blabla] does nothing more like echo (‘blabla’), but the “blabla” is on top of every page.
Any hint would be appreciated!
Thanks,
Jan
Hello Jan,
Maybe this topic will help:
https://forum.tagdiv.com/topic/article-bottom-ad-not-working-on-smart-lists/
You have to use $buffy .= do_shortcode('[td_block_ad_box spot_id="custom_ad_1"]');
Thanks.
Oh thanks, yes this is about the same problem basically.
But I’ve got another question since this will probably help me to display the text generated by the shortcode inside the article, but as I see it on any page of the smart list.
Is there any chance to find out that I’m on e.g. page 3 or the last page and just then display the shortcode? Is there any parameter where the current page number is stored?
I found out that it wpbooster/td_smart_list.php the $total_items_number is calculated, any chance to use it here like “if current page number = total_items_number then do shortcode”? (I only want to have this one).
BTW, I really appreciate the speedy support by Tagdiv. This theme is so great, and the support as well.
Hello,
The theme does count the number of slides as some smart list styles also number your titles ascending or descending so there is a detect in the code for this. I;m not sure exactly how you can use it to your advantage in this case though as i have not tested this. I do not have an easy solution to provide on this one….sorry. We try to help out where we can but we cannot tackle customization tasks as time does not allow us to. custom work is generally not part of the theme support but we do offer it if it does not take a lot of our time so we can manage to answer everybody.
Thank you for your understanding.
No problem, I figured it out in the meantime. Maybe it’s of interest to anyone with the same problem: I added this to td_smart_list.php and call it in smart_list_8 (where I need it).
protected function callback_only_on_last_page() {
$current_page = $this->get_current_page($this->list_items);
$total_pages = count($this->list_items[‘list_items’]);
if ($current_page == $total_pages) {
// last page
$buffy .= do_shortcode(‘[SOMESHORTCODE]’);
}
else {
// not last page
$buffy .= ”;
}
return $buffy;
}
