after trying different solution Now I had some information about my problem :
I already 've added MediaLibraryPickerField for My BlogPost Type,
I 'm using an alternate layout for my blog , with the name of Layout-url-test.cshtml
that the name of my blog is test .
and also creating Content-url-test.cshtml
, Fields.MediaLibraryPicker.Summary-url-test.cshtml
,Parts.Blogs.BlogPost.List-url-test.cshtml
,
the layout is ok , and my blog posts with images is displaying media , but when I added alternate file Parts.Blogs.BlogPost.List-url-test.cshtml
no images are displayed in blog post list and blog post detail !
I realized that there is some thing with my alternate files but I couldn't find any thing help full for my problem !!!
var list = Model.ContentItems;
var items = list.Items;
var body = "";
string name = string.Empty;
foreach(var post in items)
{
var blogPost = post.ContentItem;
body = post.ContentItem.BodyPart.Text;
var field =(MediaLibraryPickerField) post.ContentField;
name = field.DisplayName;
}
I could get text for bodypart but field always is null !!!
should I add some code lines in theme placement.info file ???
If your try to add a MediaLibraryPickerField for your blog post there is no need to override other views like Fields.MediaLibraryPicker or etc. What you need is override:
Content-BlogPost.Detail.cshtml
Parts.Blogs.BlogPost.List.cshtml
but for listing all posts in BlogPost.List just loop through contents and pick the ImageField like this
your placement: