Hi Newspaper Team !
Is there a way to test inside the loop if the current post is a smart list ?
I need to remove a specific part inside the loop if the post uses smart list.
I’ve tried this :
global $multipage;
if ( $multipage ) {
//whatever
}
But it’s not working. Smart list is not considered as multipage from what I understand.
I could also not display what I want with the class .paged-x (added to body – where x is the page number) but i would need to roll all possible numbers from 2 to 40 and that wouldn’t be smart (.paged-2 .myelement, .paged-3 .myelement, .paged-4 .myelement, and so on…).
Well I’m stuck. Any hint ?
Thanks in advance !
– Harold
Hi Simion,
Exactly, I have a block of content that I add on every post at the beginning through loop-single-X.php.
I don’t want to show this block of content on posts which are using Smart List.
What I want to do is something like :
if ( !is_smart_list() ) {
// add my block of content
}
I’m looking for the equivalent of !is_smart_list() or something similar to use it as a condition to show or not show this block of content. 🙂
Cheers !
Hello haroldparis,
Does not exist any such a condition with is_smart_list, sorry! If you want to display a certain code only if you will use the smart list you will have to add the following code in your smart list template and then, before {} you should add your own desired code.
<?php $td_smart_list = td_util::get_post_meta_array($td_mod_single->post->ID, 'td_post_theme_settings');
if (!empty($td_smart_list['smart_list_template'])) {
echo 'Is smartlist';
}?>
Thanks for your understanding!
Nice !
Works perfectly this way :
$td_smart_list = td_util::get_post_meta_array(get_the_ID(), ‘td_post_theme_settings’);
if (!empty($td_smart_list[‘smart_list_template’])) {
// whatever
}
Thanks a lot Catalin !