Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Using Zendesk API for article in multiple sections
// fix to display general questions in themes' sections
// using Zendesk API
// @link
(function() {
if ( $( '.breadcrumbs a[href*="200506781"]' ).length ) { // 200506781 is ID of the section for general questions
var config = {
$articleList: $( 'ul.article-list' ),
tmpl: _.template( '<li><a href="<%= url %>"><%- title %></a></li>' ),
apiUrl: '',
var appendArticles = function( data ) {
_.each( data.articles, addArticle );
var addArticle = function( article ) {
config.$articleList.append( config.tmpl( {
title: article.title,
url: article.html_url,
} ) );
$.get( config.apiUrl, '', appendArticles );
// hide dummyhide articles - if section has 0 articles fix
(function() {
$( '.article-list a[href*="dummyhide"]' ).parent().remove();

This comment has been minimized.

Copy link

@kalico1 kalico1 commented Aug 14, 2015

This is really exciting...would love to test it out. You mentioned writing a tutorial....any timeline for getting that done? I think I can piece it together from what you've said, but....stuff happens. ;-)


This comment has been minimized.

Copy link

@starr321000 starr321000 commented Aug 18, 2015

HI Primoz,

Thanks very much for putting this together. Wondering if you might have time for a question? I am getting an "Unexpected token ILLEGAL" error on line 8 when trying to implement it with my Zendesk instance. Any ideas what the issue could be?


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment