Best way to get targeted CTA's in WP?

Feb 8, 2013
1,089
27
0
juliantrueflynn.com
On my website I have a resource section. I want to get more downloads to the resource section from creating CTA's.

I thought the best course of action would be creating a custom taxonomy called "CTAs", tagging all the posts that were relevant for that CTA, and then using Widget Logic to make it only show on single posts in that category. So for my new Twitter ebook I would tag all my posts in a Twitter taxonomy and have the CTA's show on those single post pages (the actual taxonomy would be deindexed and not seen by users).

Widget Logic isn't working well for showing up in single posts in a custom taxonomy. What are you guys doing for your websites? Any guidance would help a lot.
 


So you have a downloads section with shit you want people to download.

You've created a custom taxonomy for all of the pages/posts that you want to display the call to action to your downloads section.

Instead of using a plugin, why not hard code an if statement into the single.php file, basically saying IF taxonomy = CTA, then display HTML/CSS for call to action. Else, business as usual.

I'll try to point you in the right direction. This is untested, and might not be the most effective way to do this, but throw it in and see if it works. If not, jump over to StackOverflow or hope that Rage gets his ass in here and corrects me.

What you're looking for is (located here):

PHP:
<?php if ( $taxonomy_exist = taxonomy_exists('taxonomy_name_here') ) { ?>
Insert HTML code here
<?php } ?>
 
So you have a downloads section with shit you want people to download.

You've created a custom taxonomy for all of the pages/posts that you want to display the call to action to your downloads section.

Instead of using a plugin, why not hard code an if statement into the single.php file, basically saying IF taxonomy = CTA, then display HTML/CSS for call to action. Else, business as usual.

I'll try to point you in the right direction. This is untested, and might not be the most effective way to do this, but throw it in and see if it works. If not, jump over to StackOverflow or hope that Rage gets his ass in here and corrects me.

What you're looking for is (located here):

PHP:
<?php if ( $taxonomy_exist = taxonomy_exists('taxonomy_name_here') ) { ?>
Insert HTML code here
<?php } ?>

I tried that code and even tweaked it a little from my previous research and it was still showing on all single post pages. I'm going to give this a little bit more work and I'll see what I dig up and report here incase anyone is in the same boat later.

Thanks for the Rage tag, like a bat signal :-P
 
With the help of a friend I got something like this in place that works in the single.php file:

PHP:
<?php if ($cta_sidebar != '') { 
            if($cta_sidebar[0]->slug == 'Tax Name Here'){ ?>
<p style="float:right; width:28%;"><a href="http://url.com/downloads/landing-page"><img src="http://madewithrealjuice.com/images/ebook.png" style="height:auto;"></a></p><?php } } else if($cta_sidebar[0]->slug == 'Another CTA'){ ?>

Hope that helps someone who needs something like this later. If someone knows an even better solution please let me know.