751 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 1 and 9 users
  • United States
CyberShot says

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?

2509 posts Put a Donk On It
  • Exclusive Author
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Attended a Community Meetup
  • Referred between 100 and 199 users
  • Contributed a Tutorial to a Tuts+ Site
+5 more
ThemeProvince says

Just above the loop


global $more; $more = 0;

751 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 1 and 9 users
  • United States
CyberShot says
I used a custom query like so


  $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; ?>


it doesn’t work
2509 posts Put a Donk On It
  • Exclusive Author
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Attended a Community Meetup
  • Referred between 100 and 199 users
  • Contributed a Tutorial to a Tuts+ Site
+5 more
ThemeProvince says

Have you tried it at the top of your code?

751 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 1 and 9 users
  • United States
CyberShot says

like this?



 global $more;
 $more = 0;
 $args = array( 'post_type' => 'homepage', 'posts_per_page' => 4, 'orderby' => 'title', 'order' => 'DESC' );
            $loop = new WP_Query( $args );

            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; ?>



this doesn’t work either

2509 posts Put a Donk On It
  • Exclusive Author
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Attended a Community Meetup
  • Referred between 100 and 199 users
  • Contributed a Tutorial to a Tuts+ Site
+5 more
ThemeProvince says

Why are you using the_excerpt() anyway you need to use the_content(‘Read More Stuff’); with the $more variable.

751 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 1 and 9 users
  • United States
CyberShot says

I am doing it that way because I wanted only the excerpt to be posted on the homepage and then when you click the more link, it will take you to the actual post. There are probably other ways of doing this. But this is the way I tried it first.

I used a custom post type so that the homepage posts could easily be separated from the other posts so that you don’t have to go looking through hundreds of other posts if you want to update the homepage. I am trying to set it up in ways that other authors didn’t in the themes that I have purchased. I am trying to fix some issues that have annoyed me with other purchases. Well, annoyed would be to strong, I guess just bothered me would be better.

2509 posts Put a Donk On It
  • Exclusive Author
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Attended a Community Meetup
  • Referred between 100 and 199 users
  • Contributed a Tutorial to a Tuts+ Site
+5 more
ThemeProvince says

if(!empty($post->post_excerpt)) {

the_excerpt(); 

} else {

the_content(); 

}

751 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 1 and 9 users
  • United States
CyberShot says

that does look better. Should I scrap the whole custom post idea and go back to the main loop? Thank you for you assistance

1 post
  • Has been a member for 2-3 years
lewayotte says

I know this thread is old, but I was looking for something similar, you need to do something like this:

global $more; while ( $loop->have_posts() ) : $loop->the_post(); $more = 0;

per http://codex.wordpress.org/Function_Reference/the_content#Overriding_Archive.2FSingle_Page_Behavior

by
by
by
by
by
by