I’ve created my own custom post type using this tutorial: http://thinkvitamin.com/code/create-your-first-wordpress-custom-post-type/
Everything works fine, but I’m having major problem with “Read more” feature.
As we all know <!--more-->
adds <span id="more-[number]" />
at the start of hidden more paragraph. In my case this span breaks whole markup.
See for yourself:
<p>This is normal paragraph and should be visible everywhere.</p>
<!-- everything below is available only after clicking "Read more..." button -->
<p><span id="more-[postnumber] />This is read "more" paragraph that will be displayed only on a "single" page.</p>
<p>And another "more" paragraph.</p>
In my case it creates this strange code:
<p>This is normal paragraph and should be visible everywhere.<br/>
<span id="more-[postnumber] /></br>This is read "more" paragraph that will be displayed only on a "single" page.</p>
<p>And another "more" paragraph.</p>
So the more feature in my case doesn’t even work and doesn’t even display “Read more” button.
Any ideas?
[EDITED]
Ok, so I’ve added whitespace after and before my <!--more-->
tag, so the post looks like this in admin panel now:
This is normal paragraph and should be visible everywhere.
<!--more-->
This is read "more" paragraph that will be displayed only on a "single" page.
And another "more" paragraph.
And it outputs the whole text because more span is getting an additional paragraph (why? :O):
<p>This is normal paragraph and should be visible everywhere.</p>
<p><span id="more-[postnumber] /></p> <!-- I believe it shouldn't be in the additional <p> tag and that's the point -->
<p>This is read "more" paragraph that will be displayed only on a "single" page.</p>
<p>And another "more" paragraph.</p>
And about “more button” – I’m using the_content unfortunately…
And nothing helps, when I type ‘TRUE’ as the second parameter – the_content(‘Read more…’, TRUE); – it hides everything BEFORE more tag (so it shows two last paragraphs and hides the first one).
What’s that? :O
So, two separate issues – links not displaying and faulty markup?
For links not displaying – check if your template uses
the_content()
function, more functionality doesn’t display links afterthe_excerpt()
.For markup I find that you need blank lines around more for everything to work properly.
So this can cause markup issues:
But this works fine:
The quicktag will not operate and is ignored in Templates, such as single.php, where just one post is displayed. http://codex.wordpress.org/Function_Reference/the_content