Links to latest posts published via Blog app can be embedded in your website pages; e.g., in a sidebar.
To do so, use the "Blocks" tool in your Site app as described below:
- Click on the name of block "blog.latest_posts".
- On the block-viewing screen, click on the block-embedding snippet and copy it:
{$wa->block("blog.latest_posts")}
- Paste the copied code snippet to the desired design template file in any frontend-enabled app; e.g., Site, Photos, Hub, Shop-Script, etc.
- Done! In the place where you have added the "blog.latest_posts" block snippet will be displayed links to the latest posts in your blog.
Custom setup
Blog selection
If you have several blogs set up in one Webasyst account, then there is an option for you to select only one of your blogs whose posts links will be shown to. To do so, find the following line in the source code of block "blog.latest_posts":
$wa->blog->posts()
Specify the ID of the desired blog between the parentheses:
$wa->blog->posts(2)
You can learn the ID of a blog from its backend URL; e.g., yourdomain.com/webasyst/blog/?blog=2
Post list length
By default, the list of latest blog posts is limited by 20 entries. To change this value, specify the desired limitation in the source code of block "blog.latest_posts" as shown below:
$wa->blog->posts(null, 5)
null means showing latest posts from any blogs set up in your account, not a particular one.
You can combine both of the above examples:
$wa->blog->posts(2, 5)
The first number between the parentheses is the blog ID and the second one is the post list length.
0 comments
No comments yet.