751 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 1+ members
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
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?

2588 posts Put a Donk On It
  • Elite Author: Sold more than $75,000 on Envato Market
  • Sells items exclusively on Envato Market
  • Made it to the Authors' Hall of Fame
  • Has sold $250,000+ on Envato Market
+10 more
ThemeProvince says

Just above the loop


global $more; $more = 0;

751 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 1+ members
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
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
2588 posts Put a Donk On It
  • Elite Author: Sold more than $75,000 on Envato Market
  • Sells items exclusively on Envato Market
  • Made it to the Authors' Hall of Fame
  • Has sold $250,000+ on Envato Market
+10 more
ThemeProvince says

Have you tried it at the top of your code?

751 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 1+ members
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
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

2588 posts Put a Donk On It
  • Elite Author: Sold more than $75,000 on Envato Market
  • Sells items exclusively on Envato Market
  • Made it to the Authors' Hall of Fame
  • Has sold $250,000+ on Envato Market
+10 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
  • Has been part of the Envato Community for over 6 years
  • Has referred 1+ members
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
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.

2588 posts Put a Donk On It
  • Elite Author: Sold more than $75,000 on Envato Market
  • Sells items exclusively on Envato Market
  • Made it to the Authors' Hall of Fame
  • Has sold $250,000+ on Envato Market
+10 more
ThemeProvince says

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

the_excerpt(); 

} else {

the_content(); 

}

751 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 1+ members
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
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 part of the Envato Community for over 2 years
  • Sells items exclusively on Envato Market
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

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by