Friday, March 6, 2020

Flatpress Disqus Installation Guide

This guide 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 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:

	<div itemscope itemtype="http://schema.org/BlogPosting" id="{$id}" class="entry {$date|date_format:"y-%Y m-%m d-%d"}">
				{* 	using the following way to print the date, if more 	*} 
				{*	than one entry have been written the same day,		*} 
				{*	 the date will be printed only once 				*}

		{$date|date_format_daily:"<h2 class="date">`$fp_config.locale.dateformat`</h2>"}

				<h3 itemprop="name">
				<a href="{$id|link:post_link}">
				{$subject|tag:the_title}
				</a>
				</h3>
				{include file=shared:entryadminctrls.tpl}

				<span itemprop="articleBody">
				{$content|tag:the_content}
				</span>

				<ul class="entry-footer">

				<li class="entry-info">Posted by <span itemprop="author">{$author}</span> at
				{$date|date_format}
				<span itemprop="articleSection">
				{if ($categories)} in {$categories|@filed}{/if}
				</span>
				</li> 

				{if !(in_array('commslock', $categories) && !$comments)}
				<li class="link-comments">
				<a href="{$id|link:comments_link}#comments">{$comments|tag:comments_number} 
					{if isset($views)}(<strong>{$views}</strong> views){/if}
				</a>
				</li>
				{/if}

				</ul>

	</div>

Now we need to do some editing!

Find the following code

				{if !(in_array('commslock', $categories) && !$comments)}
				<li class="link-comments">
				<a href="{$id|link:comments_link}#comments">{$comments|tag:comments_number} 
					{if isset($views)}(<strong>{$views}</strong> views){/if}
				</a>
				</li>
				{/if}

Delete that code, and then underneath the

simply in your Disqus universal code, like below:

<P> <div id="disqus_thread"></div>  
{literal}<script>  
  
/** 
*  RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS. 
*  LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/  
/* 
var disqus_config = function () { 
this.page.url = YOUR-SITE-PAGE.URL/YOUR-PAGE.php;  // Replace PAGE_URL with your page's canonical URL variable 
this.page.identifier = YOUR_UNIQUE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable 
}; 
*/  
(function() { // DON'T EDIT BELOW THIS LINE  
var d = document, s = d.createElement('script'); 
s.src = 'https://YOUR-DISQUS-SITE-NAME.disqus.com/embed.js';  
s.setAttribute('data-timestamp', +new Date());  
(d.head || d.body).appendChild(s);  
})();  
</script>  
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>{/literal}  
    </div>  

You can obviously place this where is best suited in your own code if your theme doesn’t contain a “<ul>” here, etc, but towards the bottom after the rest of the content is probably best.

To note, you MUST wrap your Disqus universal code in {literal}{/literal} tags, as script tags in the body of a page that aren’t wrapped in them is going to confuse smarty, and smarty is going to throw errors at you, which is NOT cool. This fixes that, and was something else I had to find out by searching through Smarty support forums. Anyway, back to the guide again…

Now that you’ve done that, in the same folder, you’re going to want to create a new file called “single.tpl”, and then you’re going to want to copy the contents of your index.tpl like so, and then we’re going to paste that into our newly created single.tpl:

{include file=header.tpl}
		<div id="main">

		{entry_block}

			{entry}
			{include file='entry-default.tpl'}
			{/entry}

			<div class="navigation">
				{nextpage}{prevpage}
			</div>

		{/entry_block}
		</div>

		{include file=widgets.tpl}

{include file=footer.tpl}

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

<a href="{$id|link:comments_link}#comments">{$comments|tag:comments_number}

and replace it with

<a href="{$id|link:post_link}#disqus_thread">Comments</a>

And finally, we’re going to add the following discord count script right above the tag in your footer.tpl file:

<script id="dsq-count-scr" src="//flat-1.disqus.com/count.js" async></script>

And there you have it, your Disqus comments system will be fully operational, and not to mention that all of your posts are now on their own pages, making the whole thing a bit nicer. You might have to visit your blog entry at least once for the counter to work, but that is a fault with Disqus and not Flatpress or this modification.

If you just so happen to run into any problems, then I’ll try to help, but it’s a pretty simple guide and I’m sure it will be easy enough to implement!

  1. id pro game slot

    Thursday, August 5, 2021 - 04:00:08

    Untuk kamu semua disini kami dapat membagikan bagaimana kamu sanggup mendapatkan nama nya
    ID PRO SLOT ini. Namun sebelum akan masuk ke pembahasan pembuatan ID PRO SLOT kami bakal mengupas
    sedikit manfaat dari ID PRO SLOT ini.

  2. php uzmanı

    Monday, August 16, 2021 - 01:38:14

    I do consider all the concepts you’ve presented in your post.
    They are very convincing and can certainly work. Still,
    the posts are too brief for novices. Could you please lengthen them a little from next
    time? Thank you for the post.

  3. restaurante peru

    Friday, August 27, 2021 - 12:19:33

    Hi it’s me, I am also visiting this web page regularly, this web page is genuinely fastidious and the
    users are truly sharing pleasant thoughts.

  4. tuberia hdpe

    Friday, August 27, 2021 - 12:52:57

    Your style is really unique compared to other folks I have read stuff from.
    Thanks for posting when you have the opportunity, Guess I will just book
    mark this site.

  5. demanda de alimentos

    Friday, August 27, 2021 - 12:53:01

    Hello my friend! I want to say that this article is awesome, great written and come with almost all important infos.
    I would like to peer more posts like this .

  6. Asitorboiler Com

    Sunday, August 29, 2021 - 04:55:36

    Your mode of explaining all in this article is truly fastidious,
    every one be capable of easily be aware of it, Thanks a lot.

  7. สูตรบาคาร่า

    Sunday, August 29, 2021 - 08:03:04

    That is very attention-grabbing, You are a very skilled blogger.

    I have joined your rss feed and sit up for in the hunt for more
    of your wonderful post. Additionally, I’ve shared
    your site in my social networks

  8. cluster

    Wednesday, September 1, 2021 - 05:47:17

    Hey Тhere. I fоᥙnd yߋur weblog the use of msn. This іs a rеally neatly written articlе.
    I’ll be sure to bookmark it and return to learn extra of
    your useful іnformation. Thanks for tһe post.

    I will definitely comeback.

  9. asitorboiler com

    Wednesday, September 1, 2021 - 13:50:49

    I visited several web sites except the audio
    feature for audio songs present at this site is in fact
    wonderful.

  10. porn

    Saturday, September 4, 2021 - 05:56:27

    Excellent poѕt. I was checking constantly this blog and I’m impressed!

    Extremely helpful info particularly the last part :) I care foг such info
    much. I was seeking this certain info for a long time. Thank you and
    best of luck.

  11. sv388 download

    Wednesday, September 8, 2021 - 12:37:23

    Pretty nice post. I just stumbled upon your blog and
    wanted to mention that I’ve truly loved browsing your weblog posts.
    After all I’ll be subscribing for your feed and I hope you write once more soon!

  12. gambling

    Thursday, September 9, 2021 - 04:03:20

    Good day! Do you know if they make any plugins to
    assist with Search Engine Optimization? I’m trying to get my blog to rank for some targeted keywords but I’m not seeing very good gains.
    If you know of any please share. Many thanks!

  13. xxx

    Thursday, September 9, 2021 - 04:50:16

    Hi tһere! Would you mind if I share your bloɡ ѡith my twittеr
    group? There’s a ⅼot of folkѕ that I think would really enjoʏ your
    ϲontent. Please let me know. Thanks

  14. กำไลหินนำโชค

    Thursday, September 9, 2021 - 15:47:07

    It is perfect time to make some plans for the future and it is time
    to be happy. I have read this post and if I could I want to suggest you few interesting things or suggestions.
    Perhaps you could write next articles referring to this article.
    I want to read even more things about it!

  15. Dark Web Links Directory

    Saturday, September 11, 2021 - 14:05:26

    I do agree with all of the ideas you’ve offered
    for your post. They are really convincing and can definitely work.
    Still, the posts are very brief for starters.
    Could you please prolong them a bit from next time? Thanks for the post.

  16. Look at this website

    Sunday, September 12, 2021 - 02:16:43

    When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is
    added I get several emails with the same comment. Is there any way you
    can remove people from that service? Appreciate it!

  17. Apple Store

    Monday, September 13, 2021 - 18:19:35

    Woah! I’m really digging the template/theme of this website.
    It’s simple, yet effective. A lot of times it’s challenging to get that “perfect balance” between superb usability and appearance.

    I must say that you’ve done a superb job with this. Additionally, the blog loads super fast for me on Internet explorer.
    Excellent Blog!

  18. betflix สล็อต

    Monday, September 13, 2021 - 19:33:36

    คาสิโน betflikgame เว็ปสล็อตออนไลน์ และการเดิมพันรูปแบบใหม่
    เปิดตัวมาแรงปี 2020 ด้วยระบบเติม – ถอน AUTO
    ที่รวบรวมเอาเว็บสล็อตและคาสิโน ชั้นนำมาไว้ที่นี่เพื่อความสนุกของสมาชิก
    เพียงสมัครสมาชิกสมัครรับยูสเดียว ท่านสามารถเข้าเล่นเกมส์สล็อต เกมยิงปลา และบาคาร่า จากหลากหลายเกมคาสิโนดัง
    จากบริษัทเกมโดยตรงกว่า 15 เกมสล็อต
    ยกตัวอย่าง เช่น
    Qtech, พีจีสล็อต, Joker123, NETENT,
    PlayStar, PP PragmaticPlay, BPG BluePrint

    แต่นี่คือส่วนเดียวจากค่ายสล็อตชื่อดังทั้งหมดในประเทศไทยและต่างประเทศ

    อีกทั้งยังเปิดให้แทงคาสิโนออนไลน์ออนไลน์
    บาคาร่า เสือมังกร และเกมไพ่เดิมพันแนวต่าง จากค่ายดัง เช่น
    SA Casino, Sexy Gaming, WM Casino, DGCasino, เซ็กซี่ บาคาร่า โดยบริษัทได้รวบรวมทั้งหมดนี้
    มารวมไว้ที่เดียว

    ที่ BETFLIX เรามีระบบฝาก-ถอนออโต้ที่รวดเร็ว ระบบสมาชิกใช้ง่าย และรองรับทุก อุปกรณ์ ทั้ง คอม, iOS, แอนดรอยด์ อีกด้วย

  19. หนังโป๊ไทย

    Monday, September 13, 2021 - 21:39:23

    Hɑve you ever considered publishing an e-book or guest authoring on other blogs?
    Ӏ have a blog cеntеred on the same subjects you discuss and would
    really like to have you share some stories/information.
    I know my audience would enjoy your work. If you are even remotely interested, feel free to shoօt me an e mail.

  20. คลิปโป๊

    Tuesday, September 14, 2021 - 01:24:52

    Hi thеre, juѕt became alеrt to your blog through Ԍoogle, and found that it
    is really informɑtive. I am going to watch out for brussels.

    I wilⅼ appreciate if you continue this in future.

    A lot of рeоple will be benefited from your writing.

    Cheers!