Social media button only in the post single view.

This is the right place to report general bugs, make suggestions or ask for help.
Post Reply
User avatar
fraenkiman
Posts: 30
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Social media button only in the post single view.

Post by fraenkiman » Thu Aug 18, 2022 12:25 pm

Hello, everyone,

I have integrated the Social Media buttons on my blog according to this tutorial.
Functionally very good.

But now: - I don't want the buttons to be displayed in the blog overview, where e.g. 5 posts are displayed on one page.
the buttons should only be displayed if a contribution is displayed in the single view.

Maybe someone can take a look at my entry-default.tpl:

Code: Select all

	<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}
				
				<div itemprop="articleBody">
				{$content|tag:the_content}
				</div>
				
				<ul class="entry-footer">
			
				<li class="entry-info">{$lang.comments.publishedby} <span itemprop="author">{$author}</span> {$lang.comments.worda}
				{$date|date_format}

				<div itemprop="articleSection">
				{if ($categories)} {$lang.comments.wordin} {$categories|@filed}{/if}
				</div>
				</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> {$lang.comments.timesseen}){/if}
				</a>
				</li>
				{/if}
				
				</ul>
			
				{include file=shared:entry_webshare_button.tpl} <!--- an dieser Stelle befinden sich die Social Media Share-Buttons --->

	</div>
Possibly you can build in a logic here = if post-single view then show the social media share buttons.

Thanks and best regards
Frank
My Flatpress-Blog [German]: https://frank-web.dedyn.io

George
Posts: 31
Joined: Tue May 18, 2021 10:54 am
Location: Uk
Contact:

Re: Social media button only in the post single view.

Post by George » Fri Aug 19, 2022 2:28 pm

I think if you remove {include file=shared:entry_webshare_button.tpl} <!--- an dieser Stelle befinden sich die Social Media Share-Buttons --->
from entry-default.tpl and edit index.tpl look for the line {/entry_block} on my file it is line 16
and put your code there it might work for you
just a quick heads up your icons look fine in firefox but in google chrome they look far to big
Proudly using flatpress https://www.mypoppy.uk/blog

George
Posts: 31
Joined: Tue May 18, 2021 10:54 am
Location: Uk
Contact:

Re: Social media button only in the post single view.

Post by George » Fri Aug 19, 2022 3:05 pm

it might be worth adding width="40" height="40" to your code for the share images
Proudly using flatpress https://www.mypoppy.uk/blog

User avatar
fraenkiman
Posts: 30
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: Social media button only in the post single view.

Post by fraenkiman » Fri Aug 19, 2022 6:07 pm

Hello George,

Thank you for a possible solution. Unfortunately, this only works partially. In the last post of the blog page you can still see the share buttons. I'm open to other possible solutions.
George wrote: Fri Aug 19, 2022 3:05 pm it might be worth adding width="40" height="40" to your code for the share images
I set the size of the individual buttons to 30x30px in the style sheet so that "only" 2 rows of buttons are displayed in the RESPONSIVE DESIGN. With a button size of 40x40, the buttons already fill 3 lines and appear very aggressive in the RESPONSIVE DESIGN (iPhone 11) for small posts. For testing, I went to 40x40px in the style sheet. After clearing the browser cache, you should see the change.

Best Regards
Frank
My Flatpress-Blog [German]: https://frank-web.dedyn.io

George
Posts: 31
Joined: Tue May 18, 2021 10:54 am
Location: Uk
Contact:

Re: Social media button only in the post single view.

Post by George » Fri Aug 19, 2022 6:37 pm

Ill keep working on this :) hopefully we can find a solution
the share images look much better now
Proudly using flatpress https://www.mypoppy.uk/blog

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest