Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a plugin user bookmarks - see here - and I'm trying to add a to it so the bookmark posts don't pile up like crazy. How can I do it? This is the function that displays the bookmarked posts.

function upb_list_bookmarks( $delete_link = true, $delete_text = 'Delete' ) {
if(is_user_logged_in()) {
    $display = '<ul class="upb-bookmarks-list" style="margin-left:0px;">';
        $bookmarks = upb_get_user_meta(upb_get_user_id());
        if($bookmarks) {
            foreach( $bookmarks as $bookmark) {
                $display .= '<li class="upb_bookmark bookmark-' . $bookmark . '" style="float: left; width: 200px; list-style-type: none; margin-top: 0px; margin-bottom:22px; margin-right: 25px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 35px; padding-left: 0px; background-repeat: no-repeat;" >';
                $display .= '<div class="sjena" style="display:inline-block; width:200px; height:200px; clear:both; margin-right:25px; margin-bottom:-33px;">';
                $display .= '<div class="item_lists_thumbnail" >';
                $display .= '<span class="thumbs for-image" >';
                $display .= '<a href="' . get_permalink($bookmark) . '">';
                    $display .= '<img style="width:200px; height:150px;" src="' . get_post_meta($bookmark, '_post_thumbnail', true) . '" alt=""  />';
                    $display .= '<span class="title">';
                    $display .= '<p>';                      
                    $display .=  limit_text(get_the_title($bookmark), 25);                     
                    $display .= '</p>';
                    $display .= '</span>';
                    $display .= '</a>'; 
                    $display .= '</span>';
                    $display .= '<div class="item_lists_meta" style="background:#FFF; height:190px;"></div>';
                    $display .= '<div id="bookmark_minus"></div>';
                        if($delete_link) {
                        $display .= '<a style="position:absolute; margin-top:-27px; margin-left:24px; font-family: Terminal Dosis; font-weight: 500; text-transform:uppercase; font-size:10px;" href="#" class="upb_del_bookmark upb_del_bookmark_' . $bookmark . '" rel="' . $bookmark . '" title="' . __('Remove this Bookmark') . '">' . 'remove' . '</a>' ;
                    }
                    $display .= '</div>';                       
                $display .= '</div>';
            $display .= '</li>';
            }
        } else {
            $display .= '<li class="bookmark-link no-bookmarks">You do not have any favorited looks :(</li>';
        }
    $display .= '</ul>';
}
else {
    $display .= 'You must be logged in to view your bookmarks.';
}

return $display;
}
share|improve this question

1 Answer 1

I recommend to implement a simple an flexible paging mechanism using JavaScript/JQuery/Ajax or using PHP.

If looking for the client side solution, this article about jQuery pagination plugins might be a good starting point for your research.

If you want to make more than one one actual page, you should use PHP. You can introduce a custom query variable for your paging then. Maybe this article will help you with this.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.