How to add custom shortcode in composer

Posted in: Newspaper
Post count: 8

I have a custom shortcode
[field “custom-field”]
how to insert it in custom template?
it works only when i put it in post content but not working with text element in td-composer!
any way to do that ?

Post count: 8

here the shortcode function code :

add_shortcode(‘field’, ‘shortcode_field’);

function shortcode_field($atts){
extract(shortcode_atts(array(
‘post_id’ => NULL,
), $atts));
if(!isset($atts[0])) return;
$field = esc_attr($atts[0]);
global $post;
$post_id = (NULL === $post_id) ? $post->ID : $post_id;
return get_post_meta($post_id, $field, true);
}

the problem is $post->ID give me the template ID not the post ID !

Post count: 18283

Hello !

Newspaper Theme does not have that option, you will have to insert your playlist in a Column text element. Simply copy the playlist url and insert it in the text area of the column text as you can see here: https://www.screencast.com/t/UEMEsVKog

I hope this was helpful !

Also please note our working our for the followin day:

Thank you !

Post count: 8

i’m not talking about any playlist or youtube video;
the problem is $post->ID in my shortcode script give me the template ID not the post ID !

Post count: 18283

Hello !

Please contact us via email at contact@tagdiv.com and provide the following:

– admin url and credentials
– cPanel url and credentials
– A link to this topic in order to identify you

Our team will take a look !

Viewing 5 posts - 1 through 5 (of 5 total)
The forum ‘Newspaper’ is closed to new topics and replies.