Adding Count Post in Page

If you are asking about woocommerce, this function is located in woocommerce/templates/loop/results-count.php Here’s the full code, you will get the logic if you go through it. $paged = max( 1, $wp_query->get( ‘paged’ ) ); $per_page = $wp_query->get( ‘posts_per_page’ ); $total = $wp_query->found_posts; $first = ( $per_page * $paged ) – $per_page + 1; $last = … Read more

query_posts works while get_posts doesn’t

Every page has a “main query” which is run before the template is loaded. The results of the main query are how WordPress determines what template to load. The standard Loop operates on the data contained in the main query, this is why it seems to just magically “work” without you having to explicitly query … Read more

Previous/Next with the same category

next_post_link() accepts a third argument which will limit the links to the same category. There is an example of this usage in the Codex: next_post_link( ‘%link’, ‘Next post in category’, TRUE ); in_same_term (boolean) (optional) Indicates whether next post must be within the same taxonomy term as the current post. If set to ‘true’, only … Read more

Woocommerce Add to Cart function

You cannot integrate affiliate products into your site’s shopping cart by simply injecting an iframe into your html page. In woocommerce, when you add a product to the cart you pass a product id. The cart function then looks for the product details in your store’s product database. Since you have not imported your affiliate’s … Read more