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: 210
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
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

George
Posts: 46
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: 46
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: 210
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
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

George
Posts: 46
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

User avatar
fraenkiman
Posts: 210
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 » Mon Dec 26, 2022 5:00 pm

Hello all,

I need to drill down a bit on the "share buttons" topic.
My goal is that the sharebuttons are only displayed when the post is called individually.

The buttons should not be shown when the post overview (?paged=1, ?paged=2) is displayed.

The solution of placing the buttons in the index.tpl file was only partially successful.

Code: Select all

{include file="header.tpl"}
{include file="widgetstop.tpl"}
		<div id="main">
		
		
		{entry_block}
		
			{entry}
			{include file="entry-default.tpl"}
			{/entry}
				{include file="shared:entry_webshare_button.tpl"}
			<div class="navigation">
				{nextpage}{prevpage}
			</div>
			
		{/entry_block}

		</div>
			

		{include file="widgets.tpl"}
{include file="widgetsbottom.tpl"}				
{include file="footer.tpl"}
Maybe someone knows a solution to design the template in such a way that the buttons are only displayed in the single post view.

Happy New Year
Frank
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

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

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

Post by George » Wed Dec 28, 2022 4:06 pm

try looking at readmore plugin
i have had some
success but it is in need of more work
https://www.mypoppy.uk/blog-test/
Proudly using flatpress https://www.mypoppy.uk/blog

User avatar
fraenkiman
Posts: 210
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 » Tue Jan 03, 2023 1:10 am

Hello George,

Happy New Year.
That was a hot tip. Thank you. I have added the plugin to the wiki.

With best regards
Frank
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io


Post Reply

Who is online

Users browsing this forum: No registered users and 40 guests