-
AuthorPosts
-
October 9, 2014 at 3:51 pm #333294
The problem is simple. I’m wanting to add an exact button that is output with shortcode into my single.php file for every single post on my website template.
Here is the code I’m wanting to add:
[av_button label='Download Detailer' link='manually,http://#' link_target='_blank' color='red' custom_bg='#444444' custom_font='#ffffff' size='medium' position='left' icon_select='yes' icon='ue850' font='entypo-fontello' custom_class='detailer-button']
But unfortunately, the post outputs the text rather than the generated button via shortcode. Is there a simple way to do this? I can’t find a solution anywhere.?
October 10, 2014 at 5:53 am #333659Hey BrianBookwalter!
Thank you for using Enfold.
Please use the do_shortcode function. Refer to this link: http://codex.wordpress.org/Function_Reference/do_shortcode
Best regards,
IsmaelNovember 22, 2016 at 1:21 pm #715291Hi,
I’m facing the same issue. I’d like to have a full width slider in my single post page. For that reason I duplicated the single.php and put it in my Child theme. After looking at the codex page you refer to, I tried this code:
echo do_shortcode('[av_slideshow size='no scaling' animation='slide' autoplay='false' interval='5' control_layout='av-control-default' custom_class=''] [av_slide slide_type='image' id='328' video='' mobile_image='' video_ratio='' title='' link_apply='' link='lightbox' link_target=''][/av_slide] [/av_slideshow]');
Or this one:
<?php echo do_shortcode('[av_slideshow size='no scaling' animation='slide' autoplay='false' interval='5' control_layout='av-control-default' custom_class=''] [av_slide slide_type='image' id='328' video='' mobile_image='' video_ratio='' title='' link_apply='' link='lightbox' link_target=''][/av_slide] [/av_slideshow]');?>
In both cases, no luck. Do I have to put this code somewere in order to make it work?
function do_shortcode( $content, $ignore_html = false ) { global $shortcode_tags; if ( false === strpos( $content, '[' ) ) { return $content; } if (empty($shortcode_tags) || !is_array($shortcode_tags)) return $content; // Find all registered tag names in $content. preg_match_all( '@\[([^<>&/\[\]\x00-\x20=]++)@', $content, $matches ); $tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] ); if ( empty( $tagnames ) ) { return $content; } $content = do_shortcodes_in_html_tags( $content, $ignore_html, $tagnames ); $pattern = get_shortcode_regex( $tagnames ); $content = preg_replace_callback( "/$pattern/", 'do_shortcode_tag', $content ); // Always restore square braces so we don't break things like <!--[if IE ]> $content = unescape_invalid_shortcodes( $content ); return $content; }
Help is much appriciated!
Cheers,
Steven
November 24, 2016 at 7:08 am #716279Hi,
Instead of editing the single.php file, please add this code in the functions.php file.
add_action('ava_after_main_title', 'ava_after_main_title_mod'); function ava_after_main_title_mod() { if( is_singular('post') ) { echo do_shortcode("[av_slideshow size='no scaling' animation='slide' autoplay='false' interval='5' control_layout='av-control-default' custom_class=''][av_slide slide_type='image' id='328' video='' mobile_image='' video_ratio='' title='' link_apply='' link='lightbox' link_target=''][/av_slide][/av_slideshow]"); } }
Best regards,
IsmaelNovember 24, 2016 at 11:57 am #716366Hi Ismael,
Thanks for the code. It does work. However there’s a dark grey area just above the header image what I can’t explain. You maybe?
Regards,
Steven
November 25, 2016 at 5:33 am #716645Hi Steven,
I get a 404 page on the URL you posted, could you check please?
Best regards,
RikardNovember 25, 2016 at 10:31 am #716744Sorry wrong URL…
Cheers,
Steven
November 26, 2016 at 6:13 am #717136November 26, 2016 at 8:59 pm #717260Hi Rikard,
Sorry, my bad.. It’s a file that is updated automaticly so the URL changes… Just made a “static” post.November 26, 2016 at 10:40 pm #717284Hey!
Please add
.avia-slideshow { margin: 0px !important; }and we will be happy to help you.
Thanks a lot
Cheers!
BasilisNovember 29, 2016 at 11:27 am #718174Hi,
Worked! Thanks. What would the right code be if I want to show the logo over the image like on the frontpage? In debug mode I see this code of the slider on my frontpage (see link in PC):
[av_slideshow_full size='no scaling' stretch='' animation='slide' autoplay='false' interval='5' control_layout='av-control-default' src='' attachment='' attachment_size='' position='top left' repeat='no-repeat' attach='scroll' custom_class=''] [av_slide_full slide_type='image' id='328' video='http://' mobile_image='' video_format='' video_ratio='16:9' title='<img src="http://185.27.141.7/~ptsy386879/wp-content/uploads/2016/11/logo-studijob.png" class="sliderlogo">' custom_title_size='' custom_content_size='' caption_pos='caption_left' link_apply='' link='lightbox' link_target='' button_label='Click me' button_color='light' link1='manually,http://' link_target1='' button_label2='Click me' button_color2='light' link2='manually,http://' link_target2='' font_color='' custom_title='' custom_content='' overlay_opacity='0.5' overlay_color='' overlay_pattern='' overlay_custom_pattern=''][/av_slide_full] [/av_slideshow_full]
When I replace your code:
[av_slideshow size='no scaling' animation='slide' autoplay='false' interval='5' control_layout='av-control-default' custom_class=''][av_slide slide_type='image' id='328' video='' mobile_image='' video_ratio='' title='' link_apply='' link='lightbox' link_target=''][/av_slide][/av_slideshow]
With the “debug” one, PHP error because of the http in the code…
Regards,
Steven
December 4, 2016 at 4:48 am #720124Hi,
I’m sorry but I can’t see the “dark gray” area in the page. Could you please provide a screenshot of the issue? Is the “blue space” above the image intentional?
// http://185.27.141.7/~ptsy386879/wp-content/uploads/2016/11/header-vervolgpagina-1500×607.jpg
Best regards,
IsmaelDecember 6, 2016 at 11:40 am #720935Hi,
That’s right because Basilis gave me the solution to remove the gray area. My follow up question was: What would the right code be if I want to show the logo over the image like on the frontpage? See my previous post. And the blue space is part of the image..
Cheers,
Steven
December 9, 2016 at 5:45 am #722317Hi,
The test pages are gone. Could you please re-create those pages again so that we can inspect it?
// http://185.27.141.7/~ptsy386879/2016/11/26/test2/
// http://185.27.141.7/~ptsy386879/2016/11/26/testBest regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.