Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Add the custom columns to the book post type:
- add_filter( 'manage_elementor_library_posts_columns', 'elstem_set_custom_edit_book_columns' );
- function elstem_set_custom_edit_book_columns($columns) {
- unset( $columns['author'] );
- $columns['shortcode'] = __( 'Shortcode', 'shortcode-support-for-elementor-templates' );
- return $columns;
- }
- // Add the data to the custom columns for the book post type:
- add_action( 'manage_elementor_library_posts_custom_column' , 'elstem_custom_book_column', 10, 2 );
- function elstem_custom_book_column( $column, $post_id ) {
- switch ( $column ) {
- case 'shortcode' :
- echo '[el_shortcode id="'.$post_id.'"]';
- break;
- }
- }
- function elstem_the_shortcode_func( $atts ) {
- ob_start();
- if (class_exists("\\Elementor\\Plugin")) {
- $post_ID = $atts['id'];
- $pluginElementor = \Elementor\Plugin::instance();
- $contentElementor = $pluginElementor->frontend->get_builder_content($post_ID);
- echo apply_filters('the_content',$contentElementor);
- }
- return ob_get_clean();
- }
- add_shortcode( 'el_shortcode', 'elstem_the_shortcode_func' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement