Archived topic
php & shortcode help
11 replies · Started by Heath on May 7, 2015
First, thank you Tom for awesome support and helping me before with displaying header images based on post category!! Also, the add-ons are great.
I'm stumped trying to use GP Hooks with the Advanced Post Slider plugin. I read several other forum posts, and what worked for them doesn't seem to be working for me.
So, if I use just the shortcode, it works fine! ( shortcode: [advps-slideshow optset="1"] ) But, if I try to use the php below, it does not work. Strange.
<?php echo do_shortcode('[advps-slideshow optset="1"]'); ?>
Obviously I need to solve this before I combine it with additional php "if" commands.
Thanks in advance for your continued support!
Are you checking the Execute PHP checkbox while using PHP?
<?php echo do_shortcode('[advps-slideshow optset="1"]'); ?>
Out of curiosity, why not just use the shortcode?
Thanks for the super quick reply!
I do have the execute box checked. I want to use php so I can add an "if" condition for home page only.
And this doesn't work?
<?php if ( is_front_page() ) : ?>
<?php echo do_shortcode('[advps-slideshow optset="1"]'); ?>
<?php endif; ?>
How about this?
<?php if ( is_front_page() ) : ?>
[advps-slideshow optset="1"]
<?php endif; ?>
The second one worked! Isn't that strange that I can't use "do_shortcode"??
One last question, how do I add space after the slider element? I would use your element spacing add-on, but I only want the extra space to occur when the slider is present (front page).
Thanks Tom!
That is strange - not sure what would cause that.
You can wrap the slider in a div which you can add spacing to:
<?php if ( is_front_page() ) : ?>
<div class="slider-spacing">
[advps-slideshow optset="1"]
</div>
<?php endif; ?>
Then add this CSS:
.slider-spacing {
margin-bottom: 20px; /* or whatever */
}
You're the man. The margin spacing worked, but now I see the problem is the spacing IN the slider itself. http://www.notwrittenby.com See the thumbnails being cut? I could ask the plugin support forum.
Was that not happening before adding the spacing above?
The thumbnails were always cut off. But, I thought adding the margin spacing you helped me with would solve the problem. It only added more gray space.
Hmm, you may have to ask them.
You can try:
#advps_container1 #bx-pager {
position: relative !important;
bottom: auto;
}
Then you may have to adjust some more spacing etc..
Wow, that worked. I just had to adjust the bottom margin to negative px.
Thanks for your time!
No problem :)