I am trying to embed kajabi into a WP page, I am using WPBakery if this is necesarry. The Kajabi is an email capture form and I need it to in a specific part of a page. Can anyone help me with this? Thank you! This is the sample code of kajabi
<script src=.js></script>
I am trying to embed kajabi into a WP page, I am using WPBakery if this is necesarry. The Kajabi is an email capture form and I need it to in a specific part of a page. Can anyone help me with this? Thank you! This is the sample code of kajabi
<script src=https://mykajabiwebsite/forms/123456/embed.js></script>
1 Answer
Reset to default 0Welcome to WPSE. When asking a question it is recommended to include your research and what you've already tried in your question.
One option would be to turn the script into a shortcode with add_shortcode()
. With a custom shortcode you can have any Kajabi form anywhere on your site as long as the shortcode takes the form ID as parameter. For example,
// add for example to child theme functions.php
add_shortcode( 'my_kajabi_form', 'kajabi_form_shortcode' );
function kajabi_form_shortcode( $atts ) {
// assuming form ids are always integers
if ( empty( $atts['id'] ) || ! is_numeric( $atts['id'] ) ) {
return;
}
return sprintf(
'<div class="kajabi-wrap">
<script src="https://mykajabiwebsite/forms/%d/embed.js"></script>
</div>',
absint($atts['id'])
);
}
Then use it in your post content with [my_kajabi_form id="123456"]
.