最近搜索
没有最近搜索

Frank Perazelli
已加入2021年5月13日
·
最后活动2021年10月27日
关注
0
关注者
1
活动总数
16
投票
4
订阅
3
活动概览
标记
文章
帖子
社区评论
文章评论
活动概览
的最新活动 Frank Perazelli
Frank Perazelli 进行了评论,
@Gizem
Here is the relevant code from my JS that produces what you are looking for:
// Limit Article List to display only 3 entries
if (document.location.href.indexOf('section') == -1 ) {
var categories = $('ul.article-list');
for (var j = categories.length - 1; j >= 0; j--) {
var articles = $(categories[j]).find('li');
var articleCount = articles.length;
var moreLink = $(categories[j]).siblings('.see-all-articles');
var moreArticles = moreLink.text();
if (moreArticles != "") {
articleCount = moreArticles.replace("See all","");
articleCount = +articleCount.replace("articles","");
moreLink.hide();
}
if ( articles.length > 3 ) {
for (var k = 3; k < articles.length; k++ ) {
$(articles[k]).hide();
}
}
// change the heading title
var catHeader = $(categories[j]).parent().find('h3 a');
var catTitle = $(catHeader).text();
var catHref = $(catHeader).attr('href');
$(catHeader).text(catTitle
//+ " (" + articleCount + ")"
);
if (articleCount > 3) {
var newSeeAllText = 'See all ' + articleCount + ' articles';
var newSeeAll = $(categories[j]).append(newSeeAllText);
}
}}
Hope this helps.
Frank on aarpfoundationtaxaide.zendesk.com
查看评论 · 已于 2016年1月14日 发布 · Frank Perazelli
0
关注者
0
投票
0
评论
Frank Perazelli 进行了评论,
This code works OK on my HC:
// Limit Article List to display only 3 entries
if (document.location.href.indexOf('section') == -1 ) {
var categories = $('ul.article-list');
for (var j = categories.length - 1; j >= 0; j--) {
var articles = $(categories[j]).find('li');
var articleCount = articles.length;
var moreLink = $(categories[j]).siblings('.see-all-articles');
var moreArticles = moreLink.text();
if (moreArticles != "") {
articleCount = moreArticles.replace("See all","");
articleCount = +articleCount.replace("articles","");
moreLink.hide();
}
if ( articles.length > 3 ) {
for (var k = 3; k < articles.length; k++ ) {
$(articles[k]).hide();
}
}
// change the heading title
var articleCount = " (" + articleCount + ")";
var catTitle = $(categories[j]).parent().find('h3 a').text();
$(categories[j]).parent().find('h3 a').text(catTitle + articleCount);
}}
Hope this solves your situation.
查看评论 · 已于 2015年7月21日 发布 · Frank Perazelli
0
关注者
0
投票
0
评论
Frank Perazelli 进行了评论,
@Geoff - I've compared what is working on our site to the code above. The only difference is this:
// change the heading title
var catHeader = $(categories[j]).parent().find('h3 a');
var catTitle = $(catHeader).text();
var catHref = $(catHeader).attr('href');
$(catHeader).text(catTitle
//+ " (" + articleCount + ")"
);
if (articleCount > 3) {
var newSeeAllText = 'See all ' + articleCount + ' articles';
var newSeeAll = $(categories[j]).append(newSeeAllText);
}
}}
See attached screen shot. If less than 3 articles, the "See all ..." does not appear.
Hope this helps.
查看评论 · 已于 2015年6月24日 发布 · Frank Perazelli
0
关注者
0
投票
0
评论
Frank Perazelli 进行了评论,
Frank Perazelli 进行了评论,
@Jose - Unfortunately the option currently available is to Follow a Section. As the Admin for my Help Center I follow all Sections so that when an author adds an article I get a notification. If you permit Comments to your articles, you can follow the article comments.
查看评论 · 已于 2015年1月09日 发布 · Frank Perazelli
0
关注者
0
投票
0
评论
Frank Perazelli 进行了评论,
We ask our users to Follow the Section. When we post a new article an email is generated to users Following that Section. If we do a major update, we temporarily remove the article by making it a draft item, Update the article and then make our edits, remove the draft checkmark and Update. This is now seen as a new article and out goes an email...
查看评论 · 已于 2015年1月08日 发布 · Frank Perazelli
0
关注者
2
投票
0
评论
Frank Perazelli 进行了评论,
@Wes - Several months ago we used a modification of your code to display the article count in parens following the Section name. In our code we used a split function which suddenly ceased working on 11/18/14. It was necessary to find a work around since Support could not locate the difficulty. I am listing both versions or our code for reference.
// Limit Article List to display only 3 entries - ORIGINAL CODE
if (document.location.href.indexOf('section') == -1 )
{
var categories = $('ul.article-list');
for (var j = categories.length - 1; j >= 0; j--)
{
var articles = $(categories[j]).find('li');
var articleCount = articles.length;
var moreLink = $(categories[j]).siblings('.see-all-articles');
var moreArticles = moreLink.text();
if (moreArticles != "") {
/* THIS IS WHAT FAILED */
var splitText = moreArticles.split(" ");
articleCount = splitText[2];
/* ------------------------------- */
moreLink.hide();
}
if ( articles.length > 3 )
{ for (var k = 3; k < articles.length; k++ )
{ $(articles[k]).hide(); } }
// change the heading title
var articleCount = " (" + articleCount + ") »";
var catTitle = $(categories[j]).parent().find('h3 a').text();
$(categories[j]).parent().find('h3 a').text(catTitle + articleCount);
} }
// Limit Article List to display only 3 entries - NEW CODE
if (document.location.href.indexOf('section') == -1 ) {
var categories = $('ul.article-list');
for (var j = categories.length - 1; j >= 0; j--) {
var articles = $(categories[j]).find('li');
var articleCount = articles.length;
var moreLink = $(categories[j]).siblings('.see-all-articles');
var moreArticles = moreLink.text();
if (moreArticles != "") {
articleCount = moreArticles.replace("See all","");
articleCount = +articleCount.replace("articles","");
moreLink.hide(); }
if ( articles.length > 3 ) {
for (var k = 3; k < articles.length; k++ ) {
$(articles[k]).hide(); } }
// change the heading title
var articleCount = " (" + articleCount + ")";
var catTitle = $(categories[j]).parent().find('h3 a').text();
$(categories[j]).parent().find('h3 a').text(catTitle + articleCount);
}}
Support suggested we post this for others reference.
Frank
查看评论 · 已于 2014年11月24日 发布 · Frank Perazelli
0
关注者
0
投票
0
评论