treehouse : what would you like to learn today?
Web Design Web Development iOS Development

help with custom post type in wordpress

  • I made a custom post type for a wordpress blog and it displays just fine. My issue is that when I post content into the excerpt box, the read more button displays as it should but when I click on it, it can't find the post. I see the content in the database only the link does not go to it. And when I click on the "view post" in the edit page, it also gives me a page cannot be displayed. Do you have any idea?
  • Paste your code.



  • $args = array( 'post_type' => 'homepage', 'posts_per_page' => 4, 'orderby' => 'title', 'order' => 'DESC' );
    $loop = new WP_Query( $args );
    global $more; $more = 0;
    while ( $loop->have_posts() ) : $loop->the_post();
    ?>
    <div class="serviceBox">
    <span class="icon"><?php the_post_thumbnail(); ?></span>
    <h2><?php the_title(); ?></h2>

    <p class="mainService"><?php the_excerpt(); ?></p>
    </div><!--END serviceBox-->
    <?php endwhile; ?>




    I am wondering if I am just doing this wrong. The idea is to display the excerpt only on the home page and then when the read more link is clicked, it will take you to the content.
  • I'm not 100% on PHP but, where's your permalink?

    Example:
    <?php echo "<h2><a href='"; the_permalink(); echo"'>"; the_title(); echo "</a></h2>"; ?>
  • Can any tell me how to make a site like imdb.com in which all links are cross referenced you can arrange movies by actor, director etc.

    I am searching for this for past 15 days there are lot of articles on Custom Post Types and Taxonmies but after implementing every article I still not able to make because there is no complete article on this!

    Plz help
  • Set rewrite_url parameter to true while you're defining your custom post type and WP handles the rest. See the codex for code examples.