I am using smart list 6 and want to show something to visitors from the second page onward. I am trying the codes below but none of them seem to work. Please advice.
<?php if ( $paged < 2 ) : ?>
Show this
<?php else : ?>
show that
<?php endif; ?>
I tried this too..
<?php if ($paged != 0) : ?>
Show this
<?php else : ?>
Show that
<?php endif; ?>
and…
<?php if( $paged != 0 ) { ?>
Show this
<?php } else { ?>
Show that
<?php } ?>
Hi,
Where are you placing the condition exactly? Try placing it in the smart list main file
– https://www.screencast.com/t/toaKlbJxNU
That would work, you could give it a try.
Something like this seems to output in the smart list
– https://www.screencast.com/t/yxWIgkNqOq6c
– https://www.screencast.com/t/EwqB1sRpcv
– https://www.screencast.com/t/tXJUtby3op8s
Maybe that is helpful for you.
I need to show a certain ad beneath the next and previous buttons starting from the second page onward. Is the below code correct? It doesn’t seem to work.
if ($current_page > 1) {
$buffy .= ‘<div style=”text-align: center; font-size: 12px; margin-bottom: 6px;”><span style=”color: #666666;”>ADVERTISEMENT</span> </div>’;}
-
This reply was modified 8 years by
tangy.
I tried it like this with a simple ad code – https://www.screencast.com/t/NkZXNtmdHQte
The ad appears like this on smart list pages except the first one
– https://www.screencast.com/t/EuYqfOScS
It doesn’t seem to work for me.
I am trying to load custom ad 2 starting from the second page. Here is the code I am tried using…
if ($current_page > 1) {
$buffy .= td_global_blocks::get_instance(‘td_block_ad_box’)->render(array(‘spot_id’ => ‘custom_ad_2’));
}
Here is my smart list 6 page code…
<?php
class td_smart_list_6 extends td_smart_list {
protected $use_pagination = true; // set this to true to use rela pagination on this template
protected function render_before_list_wrap() {
if(td_global::$cur_single_template_sidebar_pos == ‘no_sidebar’) {
$td_class_nr_of_columns = ‘ td-3-columns ‘;
} else {
$td_class_nr_of_columns = ‘ td-2-columns ‘;
}
$buffy = ”;
//wrapper with id for smart list wrapper type 2
$buffy .= ‘<div class=”td_smart_list_6’ . $td_class_nr_of_columns . ‘”>’;
return $buffy;
}
protected function render_list_item($item_array, $current_item_id, $current_item_number, $total_items_number) {
//print_r($item_array);
$buffy = ”;
//creating each slide
$buffy .= ‘<div class=”td-item”>’;
$buffy .= ‘<div class=”td-number-and-title”><h2><span class=”td-sml-current-item-nr”>’ . $current_item_number. ‘</span><span class=”td-sml-current-item-title”>’ . $item_array[‘title’] . ‘</span></h2></div>’;
$buffy .= ‘<div style=”text-align: center; font-size: 10px; margin-bottom: 5px;”><span style=”color: #666666;”>ADVERTISEMENT</span> </div> <div style=”border-top: 1px solid #e9e9e9;text-align: center; margin-bottom: 12px;”></div><!– Ezoic – TS-SL-728×90 – under_page_title –>
<div id=”ezoic-pub-ad-placeholder-105″>’;
$buffy .= ‘<div class=”adsense”>’;
$buffy .= td_global_blocks::get_instance(‘td_block_ad_box’)->render(array(‘spot_id’ => ‘custom_ad_4’));
$buffy .= “</div></div>”;
//$buffy .= ‘<div style=”border-top: 1px solid #4DB2EC;text-align: center;color: #56565A; margin-bottom: 8px;”></div></div>’;
//get image info
$first_img_all_info = td_util::attachment_get_full_info($item_array[‘first_img_id’]);
//get image link target
$first_img_link_target = $item_array[‘first_img_link_target’];
//image caption
$first_img_caption = $item_array[‘first_img_caption’];
//image type and width – used to retrieve retina image
$image_type = ‘td_696x0’;
$image_width = ‘696’;
if(td_global::$cur_single_template_sidebar_pos == ‘no_sidebar’) {
$first_img_info = wp_get_attachment_image_src($item_array[‘first_img_id’], ‘td_1068x0’);
//change image type and width – used to retrieve retina image
$image_type = ‘td_1068x0’;
$image_width = ‘1068’;
} else {
$first_img_info = wp_get_attachment_image_src($item_array[‘first_img_id’], ‘td_696x0’);
}
if (!empty($first_img_info[0])) {
//retina image
$srcset_sizes = td_util::get_srcset_sizes($item_array[‘first_img_id’], $image_type, $image_width, $first_img_info[0]);
// class used by magnific popup
$smart_list_lightbox = ” td-lightbox-enabled”;
// if a custom link is set use it
if (!empty($item_array[‘first_img_link’]) && $first_img_all_info[‘src’] != $item_array[‘first_img_link’]) {
$first_img_all_info[‘src’] = $item_array[‘first_img_link’];
// remove the magnific popup class for custom links
$smart_list_lightbox = “”;
}
$buffy .= ‘
<figure class=”td-slide-smart-list-figure td-slide-smart-list-6’ . $smart_list_lightbox . ‘”>
</figure>
<figcaption class=”td-sml-caption”><div>’ . $first_img_caption . ‘</div></figcaption>
‘;
}
$tds_smart_list_6_title = td_util::get_option(‘tds_smart_list_6_title’);
// ad smart list 6
//$buffy .= ‘<div style=”text-align: center; font-size: 12px; margin-bottom: 6px;”><span style=”color: #666666;”>ADVERTISEMENT</span> </div> <div style=”border-top: 1px solid #4DB2EC;text-align: center;color: #56565A; margin-bottom: 12px;”></div> <!– Ezoic – TS-SL-728×90-2 – under_first_paragraph –>’;
$buffy .= ‘<div class=”adsense”><div id=”ezoic-pub-ad-placeholder-106″>’;
$buffy .= td_global_blocks::get_instance(‘td_block_ad_box’)->render(array(‘spot_id’ => ‘smart_list_6’, ‘spot_title’ => $tds_smart_list_6_title));
//$buffy .= ‘<div style=”border-top: 1px solid #4DB2EC;text-align: center;color: #56565A; margin-bottom: 8px;”></div>’;
$buffy .= “</div></div></div><!– End Ezoic – TS-SL-728×90-2 – under_first_paragraph –>”;
$buffy .= “<!– google_ad_section_start –>”;
//adding description
if(!empty($item_array[‘description’])) {
$buffy .= ‘<span class=”td-sml-description”>’ . $item_array[‘description’] . ‘</span>’;
}
$buffy .= ‘</div>’;
// render the pagination
$buffy .= “<!– google_ad_section_end –>”;
$buffy .= ”;
$buffy .= ‘<div id=”ads” style=”clear:both;padding-top:15px;”><div style=”float:left;”>’;
$buffy .= ‘<!– Ezoic – TS-SL-336×280 – bottom_of_page –>
<div id=”ezoic-pub-ad-placeholder-107″><div class=”adsense”>’;
$buffy .= td_global_blocks::get_instance(‘td_block_ad_box’)->render(array(‘spot_id’ => ‘custom_ad_5’));
$buffy .= ‘</div></div></div>
<!– End Ezoic – TS-SL-336×280 – bottom_of_page –>’;
$buffy .= ‘<!– Ezoic – TS-SL-336×280-2 – bottom_of_page –>
<div id=”ezoic-pub-ad-placeholder-108″><div class=”adsense”>’;
$buffy .= td_global_blocks::get_instance(‘td_block_ad_box’)->render(array(‘spot_id’ => ‘custom_ad_3’));
$buffy .= “</div></div>
<!– End Ezoic – TS-SL-336×280-2 – bottom_of_page –>”;
$buffy .= ‘<div id=”ezoic-pub-ad-placeholder-117″>’;
$buffy .= td_global_blocks::get_instance(‘td_block_ad_box’)->render(array(‘spot_id’ => ‘custom_ad_1’));
$buffy .= ‘</div>’;
// render the pagination
$buffy .= $this->callback_render_pagination();
//$buffy .= $this->callback_render_drop_down_pagination();
$buffy .= ‘<div style=”text-align: center; font-size: 12px; margin-bottom: 2px;”></div><!– Ezoic – TS SL Native Bottom – native_bottom –>
<div id=”ezoic-pub-ad-placeholder-194″>’;
$buffy .= td_global_blocks::get_instance(‘td_block_ad_box’)->render(array(‘spot_id’ => ‘custom_ad_2’));
$buffy .= “</div><!– End Ezoic – TS SL Native Bottom – native_bottom –>”;
return $buffy;
}
protected function render_after_list_wrap() {
$buffy = ”;
$buffy .= ‘</div>’; // /.td_smart_list_6 wrapper with id
return $buffy;
}
}
I tried that like this – https://www.screencast.com/t/vucdgeVb
Result – https://www.screencast.com/t/pyn9sJAOnX
Code used
do_shortcode ('[td_block_ad_box spot_id="custom_ad_2"]')
But you said below the smart list navigation I believe. That was possible, but making it appear before and after the image while maintaining the condition, that will probably not be possible in the same file used until now.
The dedicated smart list ad appears after the image, use the smart list 6 ad spot in the theme panel.
Maybe modify the actual, smart list template for that, without the condition
– https://www.screencast.com/t/RkCdTVm4WHH
Copy the ad code above the image so the ad appears there as well. You could also modify the ad spot to custom ad 2 if that is the ad you want to display
– https://www.screencast.com/t/b19zRXucG