Wordpress: How to I display custom post types outside of the loop?
-
I want to use custom posts to allow my client to tweak text on their site outside of the loop, such as creating dynamic text on a rolling div header thingy.
-
Answer:
You can create a custom loop for that post type. An example from the WordPress documentation: $args = array( 'post_type' => 'product', 'posts_per_page' => 10 ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); the_title(); echo '<div class="entry-content">'; the_content(); echo '</div>'; endwhile; Here's the link to the page: http://codex.wordpress.org/Post_Types#Querying_by_post_type
Jeremy Hixon at Quora Visit the source
Related Q & A:
- How do I add custom attributes to javascript tags in Wordpress?Best solution by WordPress
- How can I get custom fields in wordpress?Best solution by Stack Overflow
- How do I create custom tab bar icons?Best solution by Stack Overflow
- How could I aggregate among multiple collections at once with loop?Best solution by stackoverflow.com
- How can I promote my new product outside of the US?
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.