PDA

View Full Version : Custom Hook Box as SHORTCODE - how do I implement the shortcode?



jasonmcartor
07-05-2011, 05:23 PM
I'm using an EZ Home Page layout for a new site I'm building, so I have created a Hook Box and defined it as BOTH Hooked and Shortcode in the Custom Hook Box admin. The Hook works on interior pages, as you will see in the sidebars, but I can not get the shortcode method, placed as a (HTML) Text widget. You'll see the text just displays as written.

http://robtaylor.frmboy.com/
(http://robtaylor.frmboy.com/)

I have tried both upper and lower case text for the shortcode.

Thanks for any help.
Jason

justme
07-05-2011, 05:57 PM
It looks like you may not be using the proper format for the shortcode:

“The Shortcode format is [catalyst_widget_area name =”__________”], so in this case it will be [catalyst_widget_area name =”test_shortcode”]”

http://catalysttheme.com/using-shortcodes-in-catalyst-theme/

jasonmcartor
07-06-2011, 09:32 AM
That is not working for me. I even set up a Shortcode in the Custom Hook area called my_test, with just some plain text in <p> tags and it's not displaying on the EZ Home Page. Any idea what the deal is?

eric
07-06-2011, 12:32 PM
Just to double check this I went to a Catalyst Test Site, went to Dynamik Options > EZ and enabled the "Static Homepage" with 3_3_3 widget areas.

I then went to Advanced Options > Custom Hook Boxes and created a new one, naming it "test_sc" and setting it to "Both" then typed in some basic HTML with <em> tags for italics.

I then went to Appearance > Widgets and dragged a new Text Widget into the EZ Home Top 1 Widget Area and then typed the shortcode in for my newly created Custom Hook Box:


[catalyst_hook_box name="test_sc"]

Then I went to my homepage and refreshed. There I found an italicized text snippet in EZ Home Top 1, reflecting the HTML I put in my Custom Hook Box.

So it seems to be working for me. Did any of the steps I mentioned conflict with what you're doing?

Eric

jasonmcartor
07-06-2011, 01:29 PM
@eric
I appreciate the reply. Yeah, that's what I'm doing. It appears you have an extra space after your sc_name, but I tried it that way too, with no luck. I set the Hook to "Both", and you'll see my "This is my test." text appearing in the header, but not in the EZ Home Bottom #3 Text Widget area.

My text widget code is:

[catalyst_hook_box name=”my_test”]

My HTML "hook/shortcode" is:

<em>This is my test.</em>

Thanks.
JMc

justme
07-06-2011, 03:33 PM
Can you provide your information from Core Options > Info > Version Information? Just want to make sure you have the latest.

I might be mistaken but things may be getting a little mixed up with hook box vs widget. You show your “text widget” code as “catalyst_hook_box”. If you are using a Custom Widget Area, then your code should be for “catalyst_widget_area”. If you are using a Custom Hook Box then it should be for “catalyst_hook_box”. Are you using a Custom Widget Area or a Custom Hook Box?

For some reason you are using a PHP widget in Home Bottom 2 and a Text widget in Home Bottom 3. You might try a different widget. But in the source code I see nothing in the widget, not even the text of the shortcode. So, are you trying to use the shortcode or the hook? If you have both selected then it seems like the “Hook” should be working.

Where exactly are you placing this:


[catalyst_hook_box name=”my_test”]

And where exactly are you placing this:


<em>This is my test.</em>

jasonmcartor
07-06-2011, 03:40 PM
@justme
I'm running 1.2.1 –*I'll update and see if that affects anything. Maybe that is causing the problem. I'll get back to you shortly. Thanks.

jasonmcartor
07-06-2011, 04:14 PM
@justme
…OK, updated.

My settings are as follows:
PHP Version: 5.2.14
WordPress Version: 3.1.3
Theme Version: Catalyst 1.2.2
Child Theme Version: Dynamik 1.1

I'm using one of the EZ Static Homepages, which populates the page with widgets areas. I'm then using a text widget to display a shortcode that I've created in the Custom Hook Options (defined as "Both" Hooked and Shortcode), just as Eric has demonstrated. You'll see the shortcode text included in the widget does not even appear on the home page. Any ideas?

** Maybe I wasn't clear with where my code was being placed. The <em> (<em>This is my test.</em>) italic code was my Hook/Shortcode, created in the Custom Hook Boxes Options. The other code ([catalyst_hook_box name=”my_test”]) is what was placed in the Text Widget that should populate EZ Home Bottom #3.

Thanks.
JMc

jasonmcartor
07-07-2011, 02:38 PM
Is this being looked into, or do I need to consider another solution? Thanks. JMc

justme
07-07-2011, 03:52 PM
As I’m sure you can understand, if we have tested using the same technique and cannot replicate the issue then it’s difficult to know what to advise.

I have done additional testing and everything works as it should for me. I can think of a couple things to check.

1. Make sure you are using plain text. If you use smart or curly quotes your code may not work. They need to be straight, plain text quotation marks.

2. You might want to deactivate plugins to see if one is causing a conflict.

I’m guessing the issue is number one above.

jasonmcartor
07-07-2011, 04:21 PM
@justme
Curly quotes were the problem–it was the copy/paste of the code. Figured it would end up being something stupid like that. Can you set up your forum so that pasted code removes Curly Quotes? I bet this has tripped someone else up, before. Thanks for the attention! Really enjoying working with Catalyst. :) JMc