Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I created a custom post type (portfolio), with custom taxonomy (portfolio-category). I created a template, this template lists all "portfolio" posts.

        <?php while ( have_posts() ) : the_post(); ?>
        <h2><?php the_title(); ?></h2>
        <?php the_content(); ?>
        <?php endwhile; ?>
        <?php $mypost = array( 'post_type' => 'portfolio', );
        $loop = new WP_Query( $mypost ); ?>
        <div class="portfolio-arrows" id="p-arrow-left" data-scroll-by="-300"></div>
        <div class="portfolio-arrows" id="p-arrow-right" data-scroll-by="300"></div>
        <div class="inner">
            <ul id="portfolio-container">
                <?php while ( $loop->have_posts() ) : $loop->the_post();?>
                <li  id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
                    <div class="portfolio-content">
                        <h2 class="portfolio-title"><?php the_title(); ?></h2>
                        <span class="portfolio-date"><?php the_date(); ?></span>
                        <?php the_content(); ?>
                    </div>
                    <?php if ( has_post_thumbnail() ) { ?>
                    <div class="featured-p-image">
                        <?php the_post_thumbnail( 'portfolio-size' ); ?>
                        <div class="featured-p-image-hover">
                        <?php
                            $fullimage_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), "full" );
                            echo'<a href="'.$fullimage_src[0].'" class="fancybox"></a>';  
                        ?>
                        </div>
                    </div>
                    <?php } ?>
                </li>
                <?php endwhile;  ?>
            </ul>
        </div>

As you can see <?php while ( have_posts() ) : the_post(); ?> in this page template the user can add content above the wp_query.

I created a file, taxonomy-portfolio-category.php with same content. With this I would like to list posts by term, but I would like to show the "user managed" content above the query too. (The result is: I get same page, but instead of the unique content (user managed) I see the list by the term.)

How can I do that? Or what's the best way for that?

share|improve this question
add comment

1 Answer

You can use the term description with echo term_description() or create a new custom post type for these descriptions and associate each post in that post type with one or more terms.

The term description is probably faster, but the custom post type can be searched, and you can add metaboxes and everything else like in other posts.

share|improve this answer
    
Maybe is misunderstanding, but I would like to show the original page's content on the term page. Btw term desc not good for me, because the user add the content when he/she create the page with my template. It sounds strange.. maybe it's impossible. –  robert Mar 21 '13 at 21:38
    
I thought you are talking about the taxonomy archive. Why don't you use that? –  toscho Mar 21 '13 at 21:40
    
What is taxonomy archive, taxonomy-portfolio-category.php this? I don't know what to use if I would like to show the original title and content (what I created as page), under that the filtered list. –  robert Mar 21 '13 at 22:18
    
@robert Each taxonomy gets its own archive and its own template if you want it. Happens automatically. –  toscho Mar 22 '13 at 8:53
    
Oh, yes i understand. What do you think about my idea to show the original page template's content on every related page is it possible, or you think better to remove this idea? –  robert Mar 24 '13 at 10:47
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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