I’ve recently included a wordpress install with full integration into magento using the fishpig plugin. I am struggling to limit the character/word count for posts on the homepage.
FishPig have documented a widget for posting excerpts including the following code:
<block type="wordpress/sidebar_widget_posts" name="wordpress.widget.recent_posts" as="recent_posts" template="wordpress/sidebar/widget/categoryposts.phtml">
<action method="setTitle"><title>Latest Posts</title></action>
<action method="setPostCount"><post_count>5</post_count></action>
<action method="setExcerpt"><display>on</display></action>
<action method="setExcerptLength"><length>30</length></action>
<action method="setDate"><date>on</date></action>
<action method="setCommentNum"><comments>on</comments></action>
</block>
i would assume i could imitate the “setExcerptLength” into a post as “setPostLength” and include in my wordpress.xml within the homepage block
<block type="wordpress/post_list" name="wordpress_post_list" template="wordpress/post/list.phtml">
<block type="wordpress/post_list_pager" name="wordpress_post_list_pager">
<action method="setPostLength"><length>30</length></action>
</block>
</block>
however these seems to have no effect.
I assume that all wordpress functions have been converted into xml with the full integration so i cannot take the usual root.
Any help on this would be greatly appreciated.
Having recently integrated wordpress into magento using the fishpig plugin i’ve also found the excerpt length to have no effect.
Without digging into the code too much my solution has been as follows.
Rather than use the xml insert the following directly in your page content. Make sure to delete any xml you have added.
In your template directory
Make a new file, post-hp.phtml
Copy the contents of categoryposts.phtml into this new file.
Find and replace
With
You will have to edit categoryposts.phtml. Change the line
to
Make sure you set the length from 30 to something high like 700 if you have an image
For all you visual learners….you can also do it manually by clicking the “Insert More Tag” icon within the kitchen sink on the “create new post” page.
Just choose a line break area, 4-6 paragraph lines usually does the job…and click the button.