Custom Fields for Content Query Web Part for Pages Library
-
11-10-2020 - |
Question
In SharePoint 2013, I have a Pages library full of press releases. A press release page layout contains the following: Title, Article Date, Contact Name, Contact E-mail Address, Page Content.
On the homepage, I want to display the 10 most recent press releases and only display Title, Article Date and Page Content.
The custom Content Query Web Part has Title and Description fields I can use for Title and Page Content. How do I add the field for Article Date?
La solution
You should create/modify the itemStyle
for your CQWP
with your custom field like AreticleDate
.
Steps:
- Open your Root site via SharePoint Designer.
- Go to all files >
Style library
>XSL Style Sheets
>ItemStyle.xml
- Create a copy from
ItemStyle.xml
then > Edit it as advanced mode.
- Find the currently selected item style name > at any appropriate place in this template add
<div class="article-date"> <xsl:value-of select="@ArticleDate" /> </div>
- Save > Check In > Publish as Major Version.
- After you finish > go to your QCWP > Edit it > and select your custom style from Presentation > Styles > Item Style.
- Bind the fields to display based on your fields in your page.
See also :- Displaying Custom Fields in a SharePoint 2013 Content Query Web Part
Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange