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 am new to WordPress. My problem is that I created a custom post type named Atividades and when I create a post, it does not appear on the website.

// fuctions.php
add_action( 'init', 'create_post_type' ); function create_post_type()
{ register_post_type( 'acme_atividade',         array(          'labels' => array(
                'name' => __( 'Atividades' ),
                'singular_name' => __( 'Atividade' )            ),      'public' => true,       'has_archive' => true,      )   ); }

// index.php
<div id="atividades">
                    <div id="col1">
                        <div style="background: url('<?php echo $thumbnail; ?>') no-repeat;" id="q-1">

                <?php
                $thumbnail = '';
                if (function_exists('has_post_thumbnail')) {
                if ( has_post_thumbnail() ) {
                $thumbnail = get_the_post_thumbnail($post->ID,'thumbnail');
                }
                }
                ?>

                <?php 
                query_posts(array( 
                'post_type' => 'Atividades',
                'posts_per_page' => 1 
                ) );  
                ?>

                <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

                <?php if ( has_post_thumbnail() ) { the_post_thumbnail(); } ?>

                <h1 class="title"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>

                <?php the_content(); ?>

                <?php endwhile; else: ?>

                <h1 class="title">Ups...</h1>

                <p>... pedimos desculpa mas nenhum <em>post</em> foi encontrado!</p>

                <?php endif; ?>

                <p align="center"><?php posts_nav_link(); ?></p>

            </div>
                        </div>
                        </div>

Is there anything wrong?

share|improve this question
1  
As this is no chat and questions & answers serve as source for later readers, please care about your MarkUp and use upper-, lowercase letters. Please go back and edit your question, so your MarkUp is readable. Hint: There's a WYSIWG editor to help you. –  kaiser Mar 4 '13 at 13:34

1 Answer 1

In your index.php the query_post should be :

 query_posts(array( 
     'post_type' => 'acme_atividade',
     'posts_per_page' => 1 
  ) );  

You should use the name of the post type acme_atividade instead of the post type's label.

share|improve this answer
    
not working yet :( –  guest333 Mar 4 '13 at 12:51
1  
Please explain why that could solve the problem. –  toscho Mar 4 '13 at 13:25

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.