APPLY FOR A FREE CONSULTATION
Supercharge your SEO! Subscribe to our newsletter for the latest SEO tactics & best practices

WordPress: Conditional Call to Action after a Post Based on Category

By Tim Brown
Updated February 16, 2016
No Comments
Tim Brown
Tim Brown

Tim Brown is the owner of Hook Agency, an SEO and Web Design company focused primarily on driving traffic and leads for small businesses, roofers and construction companies.

After reading many posts on HubSpot, I was always appreciative that their call to actions at the end of blog posts were specific to what I just read. When I finished a post about social media, there would be a call to action: “Enter your e-mail now, for a free download of ’99 quick tips for skyrocketing your social media engagement’ or if I finished a post about WordPress there would be a call to action: “Sign up now to get a WordPress Snippet a day for better development.”

So this has all kinds of applications –

Figure out what makes sense for your situation

Getting specific is important – so for you marketing minded people who code – you can use this WordPress snippet to create a conditional call to action after a post based on the category of the post the visitor is reading.


<?php if (in_category('marketing')) ?>

<img src="https://placehold.it/650x350?text=Marketing+Blog+Call+To+Action">

<?php elseif (in_category('web-design')) : ?>

<img src="https://placehold.it/650x350?text=Web+Design+Call+To+Action">

<?php elseif (in_category('web-development')) : ?>

<img src="https://placehold.it/650x350?text=Web+Development+To+Action">

<?php else : ?>

<?php endif; ?>

An example of this is right below for my WordPress development category. Since this post is in that category, I am showing a call to action for my forthcoming e-book “WordPress Development for Noobs.”


 

Watch this quick video to see how savvy businesses save time and hook better leads:
 

  •  
  •  
  •  
  •  

Related Posts

Tim Brown
Tim Brown

Tim Brown is the owner of Hook Agency, an SEO and Web Design company focused primarily on driving traffic and leads for small businesses, roofers and construction companies.

Download my E-book "WordPress Development for Noobs" for free right now:

  • This field is for validation purposes and should be left unchanged.
Only the best of web design & marketing
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

Want to hook better leads with hard-working digital marketing?


Get a free consultation now

Most businesses worry about bringing in enough leads

We build beautiful websites and aggressively integrate them with Google search to hook better leads, so you can focus on what you love to do most - serving your customers
GET A FREE CONSULTATION