Thank you!
Hello:
I am trying to master shortcodes and am a bit confused. I get the php part and even the basic logic.
Content of my kfunctions.php file which is in the CouchCMS root:
<?php
$FUNCS->register_shortcode( 'hello', 'hello_handler' );
function hello_handler( $params, $content=null ){
return '<h1>Hello from a shortcode!</h1>';
}
I'm new to php but doesn't there need to be a close tag? ?>
What I don't get is where to put these tags.
I have a template (basic HTML file structure) that has an editable region:
<cms:editable
name='main_content'
label='Content'
type='richtext'
order='2'
>
[hello]
Custom HTML here
</cms:editable>
I tried wrapping the editable tags with <cms:do_shortcodes>...</cms:do_shortcodes> and then writing the [hello] inside the editable area to test it. It doesn't render on the page.
Do I need to place the code within the template tags at the top?:
<?php require_once( 'couch/cms.php' ); ?>
<cms:template title='Contact Us' order='10'>
<cms:do_shortcodes>
<cms:show main_content />
</cms:do_shortcodes>
</cms:template>
I tried this but it isn't working either.
I'm not a PHP guru and would appreciate it if I didn't receive any flames for what might be a stupid question. I'm missing something major even though I thoroughly read the shortcodes documentation page. Please don't just point me there.
Any help would be appreciated.
Thanks.