i have wordpress blog in my custom built website, i am displaying some posts from wordpress blog into my website based on tags like below
require('../news/wp-blog-header.php');
$query = new WP_Query('tag=Dalaman');
if ($query->have_posts()):
while ($query->have_posts()) : $query->the_post();
?>
<h3> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<p><?php the_content();?></p>
<?php
endwhile;
endif;
the_content
displays the 10 posts
from wordpress database based on WP_Query
Problem: i want to display some part of the post, let’s say 55 chracters
posts, in my db dont have excerpt
by default and i dont want to use the_exerpt()
as it strips html tags and my post contains <img>
on start of every post
i tried many things but all went in vain,i also used php’s substr()
function, but it didn’t work in this case.
so how can i display somepart of the post along with image ?
very much thanks.
Kind Regards !
you can do it like below,
http://codex.wordpress.org/Function_Reference/the_content
I suggest you do what the article says and insert a
<!--more-->
at the breakpoints whenever – this is more safer than stripping an arbitrary amount of characters because you may break your html tags that way.If you’re not concerned about that, then instead of
do