Home > Forum

Support Forum

I need help with Shortcoder!

I need help with Shortcoder!

Postby hotstreak » Mon Feb 07, 2011 2:13 pm

I have a blog where all of my categories are the 50 states of the United States. Much of my content has more than 1 category. What I am looking for is a way to replace the "state" name in each post. For example:

Filed under categories "Pennsylvania" and "Florida" is the post:
-------------------------------------------------------------------------------------------------------------------------------------------
Buyers are enticed by the 'almost too good to be true' prices they see on short sales and foreclosures. I've found that many buyers don't really understand the downsides to these types of deals and will do my best to give you some basic information to help you make better decisions. You'll want to know enough about this so that whether you are considering buying Clearwater homes or Dunedin condos you'll be better prepared for the typical issues that can come up.
-------------------------------------------------------------------------------------------------------------------------------------------

But I want it to look like:

[state]Buyers are enticed by the 'almost too good to be true' prices they see on short sales and foreclosures in [state]. I've found that many buyers in [state] don't really understand the downsides to these types of deals and will do my best to give you some basic information to help you make better decisions. You'll want to know enough about this so that whether you are considering buying [state] homes or condos you'll be better prepared for the typical issues that can come up in [state].

So, when someon visits the post under the Pennsylvania category, it looks like:

Pennsylvania Buyers are enticed by the 'almost too good to be true' prices they see on short sales and foreclosures in Pennsylvania . I've found that many buyers in Pennsylvania don't really understand the downsides to these types of deals and will do my best to give you some basic information to help you make better decisions. You'll want to know enough about this so that whether you are considering buying Pennsylvania homes or condos you'll be better prepared for the typical issues that can come up inPennsylvania .

And the same would be for Florida or whatever state (category) page my visitors are on.

Can someone please point me in the right direction??

TY
hotstreak
 
Posts: 1
Joined: Mon Feb 07, 2011 2:01 pm

Re: I need help with Shortcoder!

Postby vaakash » Mon Feb 07, 2011 2:22 pm

I think this is not an issue with Shortcoder wordpress plugin. This is an unrelated topic related to this plugin.

Anyway, the solution is ... you have to add this code to the functions.php file in your theme directory anywhere:
Code: Select all
function shortcode_print_category( $atts ) {
   return single_cat_title();
}
add_shortcode( 'state', 'shortcode_print_category' );

I've not tested but should work.
User avatar
vaakash
Site Admin
 
Posts: 672
Joined: Sun Jan 17, 2010 11:15 am
Location: India


 


  • Related topics
    Replies
    Views
    Last post


Return to Shortcoder

cron


phpBB SEO