Hi to everyone!
I am a new Elgg's user and I have some problems changing Index page.
My Elgg version is 1.8.8 and I need to show latest blopost's list in one of Index's boxes, but only from a specific category setted by Site-wide Categories plugin.
Example: Categories=News and Recipes(for cooking)
In my index I have:
box1[last blog_post] box2[last blog_post_news] box3[last blog_post_Recipes]
How can to do this? What subtype I must to use in this code?
"
$list_params = array(
'type' => 'object',
'limit' => 5,
'full_view' => false,
'view_type_toggle' => false,
'pagination' => false,
);
//grab the latest 5 blog posts
$list_params['subtype'] = 'blog';
$blogs = elgg_list_entities($list_params);
// lay out the content
$params = array(
'blogs' => $blogs,
'bookmarks' => $bookmarks,
'files' => $files,
'groups' => $groups,
'login' => $login,
'members' => $newest_members,
);
$body = elgg_view_layout('custom_index', $params);
// no RSS feed with a "widget" front page
global $autofeed;
$autofeed = FALSE;
echo elgg_view_page('', $body);
"
(code paste from custom_index plugin in file index.php)
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Matt Beckett@Beck24
Matt Beckett - 0 likes
- Gabriele Manca@Yash1986
Gabriele Manca - 0 likes
- iionly@iionly
iionly - 0 likes
- Gabriele Manca@Yash1986
Gabriele Manca - 0 likes
- iionly@iionly
iionly - 0 likes
- Team Webgalli@webgalli
Team Webgalli - 0 likes
- Gabriele Manca@Yash1986
Gabriele Manca - 0 likes
You must log in to post replies.Please don't make duplicate posts, it makes it harder for people to follow the conversation and wastes time/effort for people trying to answer your question. I've deleted your other post.
@matt beckett
thank's, i do not what is the best group for this issue and i post in both groups. Sorry for the error.
Not sure if this will work. Try it with adding the following to custom_index/views/default/page/layouts/custom_index.php (you need to add it where it fits best for your needs and you also need to add the language strings used to your language file):
@iionly
Thank you for your help.
Unfortunately, the code does just what I require.
Practically in the box now shows only posts with a category set but does not distinguish between news and recipe. It also shows the whole post instead of just the extract.
Do you have other suggestions?
@
fixed:
I forgot to add the lines ...
'full_view' => false,
'view_type_toggle' => false,
'pagination' => false,
in $ my_list_params
and add $ my_ in $ list_params ['metadata_value'] = 'News', to filter the category name.
Thank you very much for your help.
[for correctness insert the code fixed]
Okay. Glad you got it. I just wanted to post basically the same (including the hint about the wrong variable name in my previous post that you found on your own by now). :)
The best practice is to put the plugin enabled check ( elgg_is_active_plugin('blog') ) on the very top, so that you can skip the DB search if the plugin is inactive.
I'm here again for a similar problem.
Now I can not be the only show in the box group_blog_post Index.
Where can I find the list of types and subtypes?
I tried to write
type => group
subtype => blog
but of course is wrong.
How do I find the entity type of an object?
P.S.
I also thank @ Team Webgalli for the suggestion that surely will use