Pinterest code

Hi

Please can you tell me an easy way to add the Widget https://developers.pinterest.com/tools/widget-builder/?type=board&boardHeight=240&boardWidth=400&imageWidth=80&template=square code of

Don’t forget to include pinit.js once per page, right before the closing tag.

Thanks

Hi Amin,

Thanks for reaching out.

It depends on where you wish to add it, but one thing is certain for pinit.js, you should add this to the child theme’s functions.php

add_action('wp_footer', 'pinit_library', 99999);
function pinit_library () {?>
<script async defer src="//assets.pinterest.com/js/pinit.js"></script>
<?php }

Then add this code anywhere, like sidebar text widget, builder’s text element, and so on.

<a data-pin-do="embedBoard" data-pin-board-width="400" data-pin-scale-height="240" data-pin-scale-width="80" href="https://www.pinterest.com/pinterest/official-news/"></a>

Thanks!

Hi Added it to this page https://www.commissionit.co.uk/interior-design near the bottom but its not showing?

Hello Amin,

Thanks for updating the thread. :slight_smile:

Please add the code in Text element to display the Pinterest board. To help you get started, I have recorded a screencast that you can take a look.

Thanks.

Hi

Thanks, already had the code in my child theme as attached?

Hi There,

The page ID you entered to the code is not correct. It should be 2832.

To find your page/post ID, please take a look at this:

Hope it helps :slight_smile:

thanks changed to 2832 from 56225 however its still not working?

Please help?

Hi There,

Please share us with your admin account so we can take a closer look.

Thanks.

hi

sent a message in secure message re login.

thanks

Hello Amin,

We do not any specific email you can use for the login details.

You may use any email you have for the test user. We just need the admin details so that we’ll be able to login and check.

Thank you.

thanks updated…in secure note

Hi There,

Upon checking your website, I could see that the page ID is still 56225:

I was unable to edit the functions.php file through the theme editor. Could you please double check again?

Thank you.

ok checking.

i have got another page display it properly https://www.commissionit.co.uk/find-creative-inspiration/

if i make the change suggested will it effect this and any other pages?

Regards

looks like the issue is a plugin conflict so i can make the change manually via ftp. Before i do it please confirm …i have got another page display it properly https://www.commissionit.co.uk/find-creative-inspiration/

if i make the change suggested will it effect this and any other pages?

Hello Amin,

The code will only affect the page indicated using the page ID. If you want to display Pinterest in mulitple pages, then you will have to edit the code and include the page ID as well. For example:

add_action( 'wp_footer', 'add_pinterest_js' );
	function add_pinterest_js(){
	if( is_page(123) || is_page(345) || is_page(678) ) { ?>
		<script async defer src="//assets.pinterest.com/js/pinit.js"></script>
	<?php
	}
}

Please take notes of the post IDs of the pages so that the code will work.

ok understand now, have updated, please confirm i have the right breaks between the id’s just guessed :slight_smile:

add_action( ‘wp_footer’, ‘add_pinterest_js’ );
function add_pinterest_js(){
if( is_page(56225) || is_page(2617) || is_page(2832) || is_page(2945) || is_page(3069) || is_page(2640) || is_page(2663) || is_page(3273) || is_page(2602) ) { ?>

<?php
}
}

Hey Amin,

At a glance, that looks correct. My answer is not a guarantee though. Please note that giving custom code including working with it like fixing, enhancing or checking if it works is not covered by our support service because it’s not an issue with nor a feature of our theme. We can only provide samples if we can. You can check your custom PHP code in online tools like https://phpcodechecker.com/.

Thank you for understanding.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.