Page 1 of 1

Social media button only in the post single view.

Posted: Thu Aug 18, 2022 12:25 pm
by fraenkiman
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

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

Posted: Fri Aug 19, 2022 2:28 pm
by George
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

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

Posted: Fri Aug 19, 2022 3:05 pm
by George
it might be worth adding width="40" height="40" to your code for the share images

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

Posted: Fri Aug 19, 2022 6:07 pm
by fraenkiman
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

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

Posted: Fri Aug 19, 2022 6:37 pm
by George
Ill keep working on this :) hopefully we can find a solution
the share images look much better now

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

Posted: Mon Dec 26, 2022 5:00 pm
by fraenkiman
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

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

Posted: Wed Dec 28, 2022 4:06 pm
by George
try looking at readmore plugin
i have had some
success but it is in need of more work
https://www.mypoppy.uk/blog-test/

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

Posted: Tue Jan 03, 2023 1:10 am
by fraenkiman
Hello George,

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

With best regards
Frank

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

Posted: Sun Jan 08, 2023 12:30 pm
by Arvid
Nice one! 8-)