Support community for TTG plugins and products.
NOTICE
The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.
This forum is now closed, and exists here as a read-only archive.
You are not logged in.
Hi there,
On my homepage I have Pallet 01 copy (search / browse etc) defind in my Default Album showing up fine in the LHS column.
http://www.tasmanianphotos.com
I would like to use this same Pallet 01 copy om my regular pages (about, contact etc), without having to copy/edit mutlipe blocks of code for each page.
https://www.tasmanianphotos.com/about/ (would like to include the pallet 01 copy from the home page here - wihtout copying and pasting it).
Is there any way I can write a block of code once and use an "include" function in the pallet 01 copy box on other pages so this code is displayed there also? Therefore for updates I only need to edit one block of code - not multiple?
Cheers,
Chumby.
Offline
you can do this with phplugins using the pallet01_top hook.
This will put your content in all pages/album/sets using a page template that also uses the function in your phplugins file
function pallet01_top() {
echo'
....your html content.....
';
return false;
}
This will replace any existing pallet content with your content.
If you want any content that you added individually to pages, templates, albums, or sets to be included, then change return false; to return true;
If you want the content to appear on only certain pages (like Home, About, Contact) but not others, that can be done too.
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
If you want the content to appear on only certain pages (like Home, About, Contact) but not others, that can be done too.
I have an example of doing this over at https://lab.danielleu.com/blog/page-specific-php-code/
Daniel Leu | Photography
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com
Offline
Daniel, my original thought was to use your code (from this post: http://community.theturninggate.net/vie … 37#p54537) and I actually got that to work.
custom css works too (though Daniel's solution is way cooler)
Wrap the html content in the phplugins function in a div and give it a custom class and also hide it with display:none; using inline css.
Then in the custom css file, use the slug body class to target the custom class on certain pages to set the display to block (display: block !important;)
In phplugins:
function pallet01_top() {
echo'
<div class="special-pallet-content" style="display:none;">
<h2>Special content</h2>
<p>This is content only inserted into the pallet of certain pages</p>.
</div>
';
return false;
}
custom css:
.slug-contact .special-pallet-content, .slug-home .special-pallet-content, .slug-about .special-pallet-content {
display: block !important;
}
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
Rod, I didn't think about CSS at all. Nice to have several ways to get it done.
Daniel Leu | Photography
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com
Offline
Hi Rod and Daniel,
Thanks for these answers.
Rod - I like the idea of the CSS solution as I can target different pages. I have tred your code though and nothing is being displayed in the pallet. I have set my custom css file up with:
.slug-contact
.special-pallet-content, .slug-home
.special-pallet-content, .slug-about
.special-pallet-content { display: block !important; }
Is that the correct format to target the home and about pages with the html from the php plugins file?
Cheers,
Chumby
Offline
It's working in your About and Contact pages. You just need the correct slug for your home page.
according to the Home page source code, the selector should be .slug-images
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
Hi Rod,
Can you see anything in the side menu at https://www.tasmanianphotos.com/about/
I have cleared stored pages through IE and cleared cached templates, but nothing is appearing there for me.
Cheers
Chumby
Offline
when I look at the mobile size of that page and click the mobile menu button, I see the nav menu and the pallet content added via phplugins.
have you tried looking with other browsers
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
Chumby, I don't see your custom css to make the palette code visible.
Daniel Leu | Photography
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com
Offline
it's there starting on line 15 of the custom css file (tasmanianphotos.css)
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
here's what I'm seeing on the About page:
desktop
mobile size:
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
it's there starting on line 15 of the custom css file (tasmanianphotos.css)
not for me... maybe Chumby is doing something.
Daniel Leu | Photography
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com
Offline
Thats weird, Rod.
I cannot get that content to show on either Chrome of IE even by clearning out of the cached pages. Nothing on my phone chrome either.
Hmmm...
Cheers
Chumby
Offline
And it’s showing up on my iPad for the Contact and About pages. But not the Home page. And the reason for that is the slug for the home page as I mentioned above.
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
Thanks Rod,
All good I can see the column text now. cntrl+shirt+r did the trick.
The only trouble now is my text is not picking up the previous css - ie <p> not working. Margins are also in tight. Is there something I need to change in my css file to get this format looking ok and as it was?
Cheers,
Chumby
Offline
Yes. Just add styling to add some left and right padding to the .special-pallet-content div
.special-pallet-content {
padding: 0 12px;
}
You might also want to change the margin-top of any heading you use. By default, all h elements (h1, h2, etc.) have 3rem of margin-top. for example:
.special-pallet-content h2 {
margin-top: 1rem;
}
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
Are you going to expand the site beyond the three pages you already have? If not, then you don't need the css that targets specific pages. Just remove it and also remove the style="display: none;" from the html in the phplugins function.
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
Hi Rod,
Yes trying to get more pages than just the three, eventually So I think this is the way to go.
Have added in that css to my custom file, but I cant see any difference. Also the <p> tag does seem to be working either (as it did when it was inserted with the other code on the actual pages). Everything looks scrunched up.
Can you see a margin appearing now? I have put back in the actual text I need.
Really appreciate the help,
Cheers
Chumby
Offline
Your html isn't using the class special-pallet-content so there's no surprise that it's not working.
the reason the text is so tight on the left and right is that it hasn't been styled.
wrap all the html you're putting in there in a div and give it a custom class:
<div class="special-pallet-content">
....all your html....
</div>
In your custom css, add that class with some styling:
.special-pallet-content {
padding: 0 12px;
}
that will add 12px left and right padding
You have one div using "align:center"
That is deprecated in html5
instead, use:
<div style ="text-align:center;">
....your content...
</div>
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
Thank you so much, Rod. I will work on your suggestions.
Cheers
Chumby
Offline
Hi Rod,
Been messing with this for hours and I cannot get any indent working.
In my php_plugins I have
function pallet01_top() {
echo'
<div class="special-pallet-content">
html content
<div>
';
return false;
}
and in my css file I have
.special-pallet-content, .slug-home
.special-pallet-content, .slug-about
.special-pallet-content, .slug-contact
.special-pallet-content, .slug-images
.special-pallet-content {
display: block !important;
padding: 0 12px;
}
Can you see what I am doing wrong here?
Cheers
Chumby
Offline
your custom css does not contain the padding
this is what is currently in your custom css file:
.slug-contact
.special-pallet-content, .slug-home
.special-pallet-content, .slug-about
.special-pallet-content { display: block !important; }
did you upload an updated custom css file?
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
as a side note, and totally off topic (sorry), I see you're using a custom footer. However, in your phplugins file to implement the footer, you have to divs with the ID of "footer." IDs should only be used once per page
More here on using a custom footer: https://ttg-tips-and-tricks.barbeephoto … -pangolin/
If you have questions about this, go ahead and start a new topic.
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
Hi Rod,
Been messing with this for hours and I cannot get any indent working.
In my php_plugins I have
function pallet01_top() { echo' <div class="special-pallet-content"> html content <div> '; return false; }
Can you see what I am doing wrong here?
Cheers
Chumby
The closing div after your html content should be '</div>'.
Daniel Leu | Photography
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com
Offline