RESOLVED need snippet to insert post title within button widget, help.

Messages
2
Likes
0
Points
1
#1
[button href="http://www.d##########.com/charity-...arity=[insert_php]the_title('');[/insert_php]" target="_self" size="btn-large" type="button"]Donate to [insert_php]the_title(' ');[/insert_php], Click Here![/button]
Hi, so the above is my current button code that inserts the post title into the html href and visible text. Its a little ugly, but it works fine currently.
I'm not really a code jockey, but I can usually suss these things out, this one is stumping me...
the button basically launches the form page with the charity pre-filled into the proper location... what I cant figure out is how to replace the old php inserts to your new snippets and have them actually work... just making a snippet with " the_title(""); " certainly doesn't work, within the button code, (it works fine on its own, though) so clearly I need some education :) TIA.
 

alexkovalev

Program developer
Staff member
Messages
267
Likes
19
Points
18
#2
Hi,

Sorry delay for reply!

Follow me:
Create php snippet, it must be executed via shortcode. Paste this code in php snippet:
PHP:
echo do_shortcode('[button href="http://www.d##########.com/charity-...arity='.get_the_title().'" target="_self" size="btn-large" type="button"]Donate to '.get_the_title().', Click Here![/button]');
Use a snippet shortcode instead of a button shortcode.

Some tricks to work with the plugin, you can see in the documentation:
Getting Started with Woody ad snippets - Woody ad snippets - insert any code, text, or ads via using conditions

Best regards, Alex