• Hello, I have a small question. I am using this plugin and although its working fine but its not working for the custom shortcodes I created. Do I need to add some kind of filter or something?

    Shortcode:

    function custom_shortcode($atts) {
            $atts = shortcode_atts( array( 'category' => '', 'item_per_page' => '' ), $atts, 'custom-shortcode' );
    
            $the_slug = $atts['category'];
            $idObj = get_category_by_slug( $the_slug );
            $id = $idObj->term_id;
            $totalItems = $atts['item_per_page'];
            $args = array(
            'category'         => $id,
            'post_type'      => 'correspondencecourse',
            'post_status'    => 'publish',
            'posts_per_page' => $totalItems,
            'orderby'        => 'post_date',
            'order'          => 'ASC',
            );
    
            $my_posts = get_posts( $args );
            $posts = array();
    
            foreach ($my_posts as $post) {
                $post_id = $post->ID;
                $post_title = get_the_title( $post_id  );
                $content_post = get_post( $post_id );
                $contentHolder = $content_post->post_content;
                $content =  wpautop( $contentHolder, true );
                $permalink = get_permalink( $post_id );
                $post_pdf_url = get_post_meta( $post_id, 'course_pdf_url', true );
                if ( has_post_thumbnail( $post_id ) ) {
                    $image_id = get_post_thumbnail_id( $post_id );
                    $image_url = wp_get_attachment_image_src($image_id,'medium');
                    $image_url = $image_url[0];
                    $post_thumbnail = '<img src="'.$image_url.'" class="featured-box-image" />';
                }
    
                $buf .= '<div class="column builder one-third">';
                $buf .= '<div class="lesson-container">';
                $buf .= '<div class="pdf-img">';
                $buf .= '<a href="' . $post_pdf_url . '" target="_blank">' . $post_thumbnail . '</a>';
                $buf .= '</div>';
                $buf .= '<a href="' .$post_pdf_url . '" target="_blank"><h4>' . $post_title . '</h4></a>';
                $buf .= '</div>';
                $buf .= apply_filters( 'the_content', '</div>', $atts );
            }
            $buf .= apply_filters( 'the_content', '', $atts );
            return $buf;
        }
    }
    add_shortcode( 'custom-shortcode', 'custom_shortcode' );

    Thanks in advance for the help.

    https://wordpress.org/plugins/scripture-highlighter/

The topic ‘Integrate with Shortcode’ is closed to new replies.