joel 0 Report post Posted July 25, 2011 I would like to learn more about how to customize loops for certain categories on my webpage. I have website that sells products but also has articles that can be associated with those products. I would like to develop a number of custom loops for those pages. The custom Loop would look something like this. Name of Category static content Put in a line here Products Put in a line here each product would have a link to it's own page Put in a line here Articles Put in a line here each article would have a link to it's own page The layout would look like this http://web.prioritiesbydesign.com/admin-assist/2_church_by_laws/ but this is a static page. I would like the page to be static but have the content dynamically generated. The above is an immediate need I have but I have other places that I can use such coding. Is there a place that anyone knows of that is a good tutorial on building custom loops? Thanks!! Share this post Link to post Share on other sites
cmunns 16 Report post Posted July 25, 2011 Basically you will need to modify the template.postloop.php file in PlatformPro. Copy it to the child theme and edit it there and get familiar with conditional tags. http://codex.wordpress.org/Conditional_Tags If the page is static then you will want to learn how to add a custom loop to a page that doesn't effect the pre-existing loop `if (is_page()).....` http://codex.wordpress.org/Class_Reference/WP_Query Share this post Link to post Share on other sites
joel 0 Report post Posted July 28, 2011 Adam, In a previous Thread that was lost (I believe) I wanted to get some post to show up on a static page. You gave me this code: add_action('pagelines_inside_top_theloop','custom_loop'); function custom_loop(){ if(is_front_page()): $myquery = new WP_Query('showposts=5'); while ($myquery->have_posts()) : $myquery->the_post(); the_title(); the_excerpt(); endwhile; endif; } This all works great but I needed to modify as below. I wanted the article titles to be links to their specific post page and you gave me this code: rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?> However, I put it in and it crashes the site. What am I doing wrong and where does it go in the above code? Share this post Link to post Share on other sites
joel 0 Report post Posted August 21, 2011 This ended up being the correct code: add_action('pagelines_inside_top_theloop','custom_loop'); function custom_loop(){ if(is_front_page()): $myquery = new WP_Query('showposts=5'); while ($myquery->have_posts()) : $myquery->the_post(); echo ''; the_title(); echo ''; the_excerpt(); endwhile; endif; } Share this post Link to post Share on other sites