====== Guide: How to add Disqus comment system ======
This guide shows how to replace FlatPress' default comments with the Disqus comment system. It was originally provided by Tongara [[https://forum.flatpress.org/viewtopic.php?f=2&t=123#p286|on the support forum]]. Thank you very much, Tongara!
Please refer to the forum if you have suggestions or questions regarding this guide.
==== The Basics ====
The following assumes you already have a Disqus site created, and you've got your Disqus Universal Code ready. If not, please visit https://disqus.com/profile/signup/ and do that first.
First things first, we're going to be using the leggero default theme, but this can be done with any theme at all.
Go ahead and open up your theme's "theme.conf.php", and underneath the line that says\\
''"$theme ['default_style'] = leggero';"''
You should add the following:\\
''$theme['hassingle'] = true;''\\
That will make sure your blog entries are now displaying as their own entries on their own single page permalinks, which is a must imo.
It took me a good HOUR to find that line of code, and I randomly found it on a flatpress news update about "FlatPress 0.804 Vivace" from all the way back in May 2008 (!!!!), which can be seen [[https://www.flatpress.org/2008/05/07/flatpress-0804-vivace|here]]. I really think it should be added to the wiki's general knowledge on Flatpress. Anyway, back to the guide...
Now you're going to want to make a new file in the same directory called "single-default.tpl", and you're going to want to copy the contents of your "entry-default.tpl" like so, and then we're going to paste that into our newly created single-default.tpl:\\
Now we need to do some editing!
Find the following code
`$fp_config.locale.dateformat`
"}
{$subject|tag:the_title}
{include file=shared:entryadminctrls.tpl}
{$content|tag:the_content}
{if !(in_array('commslock', $categories) && !$comments)}
Delete that code, and then underneath the simply in your Disqus universal code, like below:
Remember to change "YOUR-SITE-PAGE.URL/YOUR-PAGE.php" to your flatpress blogs address, change "YOUR-DISQUS-SITE-NAME" to the shortname of your disqus site, and to change the identifier to whatever you like, or make it blank, it's up to you.
You can obviously place this where is best suited in your own code if your theme doesn't contain a
{include file=header.tpl}
{entry_block}
{entry}
{include file='entry-default.tpl'}
{/entry}
{include file=widgets.tpl}
{include file=footer.tpl}
{/entry_block}
Now, we're going to do a bit more editing!
Replace the following line
{include file='entry-default.tpl'}
with
{include file='single-default.tpl'}
Now we need to edit your entry-default.tpl to add the Disqus comments link and comment count. When you've opened that file, find the following line
{$comments|tag:comments_number}
and replace it with
Comments
And finally, we're going to add the following discord count script right above the