Today I did a alternative for user profile without pagination. I tried some codes on the forum for pagination, but without success for while, maybe I did something wrong, or my repurpose theme don't liked of these codes. If you know some code functional for pagination on user public profile, post the link, I'll appreciate that.
With this generic code with variables and conditions I can choose the correct position of my banner or other situation.
Some parameters if on case not correspond with total items of user comparing with position number of the banner, it will reset to second position on the listings.
All code is commented for follow the process, if you decide use it for same reasons, you can delete all comments if you want.
I tested the code only without pagination on list mode (I don't use gallery mode on my theme), maybe it works with pagination, and with gallery mode.
If you find some problem post here.
Regards
<?php
$adSense_middle_pos = ceil(osc_count_items());
$selected_position = 2; /* Change to select position independent of number items per page on public profile. */
if($selected_position >= 2){
$fix_number_position = $selected_position - 1; /* Correct position on listings. */
$regenerate = $fix_number_position - osc_count_items(); /* Will regenerate the number, subtracting the number position with total of items. */
if($fix_number_position > osc_count_items()){/* Verify the selected position number if is bigger than total items. */
$ad_counter = osc_count_items() - $regenerate; /* Is a bigger number, so need subtract with regenerate value. */
} elseif ($fix_number_position < osc_count_items()){/* Verify the reduced number if is less than total items. */
$ad_counter = osc_count_items() - $fix_number_position; /* Is a less number, so need subtract the value of position number fixed, with total number of items. */
} elseif ($fix_number_position == osc_count_items()){/* Verify the reduced number if is equal to total items. */
$ad_counter = osc_count_items() - 1; /* Will stay in second position by default */
}
} else {
$reset_second_position = 1;
$ad_counter = osc_count_items() - $reset_second_position; /* Will stay in second position by default if selected position value is less than 2 */
}
?>