wordpress fishpig magento installation - getPostListHtml() wordpress fishpig magento installation - getPostListHtml() wordpress wordpress

wordpress fishpig magento installation - getPostListHtml()


Based on your partially posted code, I can give you only a conceptual answer.

From what you've posted by now your only difference between new and old posts could be synthesised in two ways:

  1. By post_date, and you can call almost the same function, but with the last displayed post's post_date as parameter so you can filter the new results that has newer post_date. Adding a new closure before or after setOrder(...) or by changing the wpQuery;

  2. Or by offset. Considering that you won't have backdated posts, all new posts will have the offset equal with the initial posts count. so you'll have to setOffset($oldCount); This way you'll get latest posts starting from the last displayed post.

You'll just have to update the wp query with the desired parameter, or find a way to tag your posts in some other way:

  1. Eaiser way would be to keep track of your displayed post IDs in an array $displayed_post_ids, and than query with post__not_in, like the following example:

$args = array( 'post_type' => 'post', //... other args 'post__not_in' => array($displayed_post_ids) // Don't show this posts );

  1. Another alternative might be the post_meta fields. You'll have more control this way and you can use same old categories for new posts also.
    You can add a post_meta information that won't be displayed in page and that will keep track if your posts have been displayed in the first div or not. Considering is more easy to alter the posts that you already have, you can add a post_meta _wasDisplayed (using something like update_post_meta( $post_id, '_wasDisplayed', true); when you display the post in the first div can also do the trick )

You can set a default false value of that post_meta value for all your posts on creation. This will help you on the query.On the second div you will call the generator function and check if your posts have the post_meta and if it's false.

Also you can reset the post_meta values later if you need.

For implementation is also needed to be know how many posts you intend to display, if you use pagination and other small details that could make your work a bit more complex.

Notice - this case solution:

5. As you're business logic seem to be related more to categories, there's a more straightforward solution: On the backed process that adds new posts assign an additional category to every new post (something called like: "New Undisplayed Posts") this category will be used as a filter argument in the second div.Take into account that you'll have to remove this category from all the posts that are posted at the time you call the getPostListHtml() from the first div, otherwise you will have unwanted posts in the second div.

You can make this happen in a wrapper function using one of the category arguments for wp query object:

Category Parameters

Show posts associated with certain categories.

cat (int) - use category id.category_name (string) - use category slug.category__and (array) - use category id.category__in (array) - use category id.category__not_in (array) - use category id.

Hope it helps,Codrut, KMM