0

http://css-tricks.com/video-screencasts/

Try to look at this famous site which also powered by wordpress. The content in the loop is different from the single post. It use "dl" element in loop, but not main content in the single post. It something like it has a another brief summary of a post that will only display in loop.

So my trouble is how to display something(include image,article,video embedding) in the loop of multiple post but not display in single post itself, and vice versa.

3 Answers 3

1

you can add additional information to your posts through using post meta:

http://wp.tutsplus.com/tutorials/plugins/how-to-create-custom-wordpress-writemeta-boxes/

If you want to check if Wordpress is going to display just a single post/single page or more, you could use something like this before your loop:

$single_page = false;
if(is_single() || is_page()) $single_page = true;

And then in your loop you can simply write conditional code like:

if($single_page == true) echo 'single page';
4
  • can i have something like the website i given , which use DL element?
    – Kent Liau
    Commented Jul 24, 2012 at 17:19
  • I think you have to code it yourself, but a very basic example how you could do it might be this one: pastebin.com/HFRGtwAZ Of course you'd have to integrate the retrieval of meta information and so on...
    – lupor
    Commented Jul 24, 2012 at 17:37
  • It will still having the same content, for the website i given , it has totally different content in the loop (just like summary) and the real post in single. Two different content.
    – Kent Liau
    Commented Jul 24, 2012 at 17:46
  • You could use something like get_post_custom($post->ID) if you need to load meta information.
    – lupor
    Commented Jul 24, 2012 at 18:23
1

This is what the various theme templates are for. Refer to the Template Hierarchy to learn the context in which each template gets loaded.

Using your question as an example, If your theme consisted of an index.php template file and a single.php template file, index.php would be used for all pages consisting of lists of posts- the main posts page, category pages, tag pages, and single.php would be used for any singular post display.

0

I finalize 2 solution

1.) use the custom excerpt + feature image

2.) use the custom field with the get_post_custom build in wordpress function

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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