Tagged: post template
-
AuthorPosts
-
July 28, 2016 at 10:44 am #666105
Hi there,
I’d like to add a CTA button to each post by default.
What should I add to the single.php file and where?Thanks you,
Guy.July 28, 2016 at 1:38 pm #666219Hi guyco!
Depends on the position you want to add it and what you need to add.
I am really sorry, but based on your description we can not provide enough details to help you get it shorted.Please consider to provide us more details, so we can help you out.
Thanks a lot
Regards,
BasilisJuly 28, 2016 at 5:21 pm #666344Thanks for the quick reply.
Making it really general, the button should appear:
– After the last line of the post text
– Preferred it to be centered to the page (but I can handle it)
– It should be a simple button (I’ll handle the rest if needed)
– It should appear automatically without any dependency on the post content / configuration, and should appear always.Simple enough? Please feel free to give only the very basic, I’ll take it from there, thanks!
July 30, 2016 at 6:54 pm #666872Hey!
Try building the CTA content as shortcodes on a blank Page, then copy that and add this at the very end of your theme / child theme functions.php file:
function add_cta_after_post_content() { if (is_singular("post")){ ?> <div class="custom_cta"> <?php echo do_shortcode("[PASTE SHORTCODES HERE]"); ?></div> <?php } } add_action('ava_after_content', 'add_cta_after_post_content');
Cheers!
JosueJuly 30, 2016 at 10:32 pm #666903Thank you Josue!
Here is the short code I’m pasting, replacing your PASTE SHORTCODES HERE:
av_button_big label=”CREAT MY TESTIMONIAL WIDGET NOW – IT’S FREE!” link=”https://app.spectoos.com/users/sign_up” link_target=’_blank’
Here is the full line of code:
<?php echo do_shortcode(“[av_button_big label="CREAT MY TESTIMONIAL WIDGET NOW - IT'S FREE!" link="https://app.spectoos.com/users/sign_up" link_target='_blank']“); ?></div>I’m getting the following error when saving the file
Parse error: syntax error, unexpected ‘CREAT’ (T_STRING), expecting ‘,’ or ‘)’ in /home/spectoos/public_html/wp-content/themes/enfold-child/functions.php on line 73If I remove the shortcode and leave only () the file saves with no error.
What am I missing?
Cheers,
Guy.July 31, 2016 at 8:17 am #666948Hi,
Change all quotes inside the shortcode for simple ones, like:
<?php echo do_shortcode("[av_button_big label='CREAT MY TESTIMONIAL WIDGET NOW – IT’S FREE!' link='https://app.spectoos.com/users/sign_up' link_target='_blank']”); ?></div>
Best regards,
JosueJuly 31, 2016 at 8:44 am #666949Thank you!
Please find attached to see how it looks (and what the problem is)Cheers,
Guy.July 31, 2016 at 9:38 am #666967Hi,
Now add this to Quick CSS:
.custom_cta{ width:100%; clear:both; float:left; margin-top: 80px; margin-bottom: -40px; }
Best regards,
JosueJuly 31, 2016 at 9:44 am #666968You rock! thanks :)
July 31, 2016 at 4:23 pm #667014You are welcome, glad to help :)
Regards,
Josue -
AuthorPosts
- You must be logged in to reply to this topic.