This topic has 3 replies, 2 voices, and was last updated 8 years by Radu.

  • Author
  • #74660
     jonbrowne
    Participant

    I have been trying to add a visual composer short code to “posts” via editor. However, it does not work. I have tried several ad unit plugins but, they conflict with cache plugins.

    I would like to add “Kleo Posts” to the bottom of every article.

    How can I accomplish this?

    Thank you!

    #74855
     Radu
    Moderator

    Hi,

    I’ve made a little function that helps you to achieve this.

    Just replace the shortcode ( [vc_posts_grid loop="size:10|order_by:date|post_type:post"] ) with your desired shortcode.

    $shortcode = ‘[vc_posts_grid loop="size:10|order_by:date|post_type:post"]‘;

    COPY CODE
    
    function CustomKleoAddContentAfterPost( $content ) {
    
        if( is_single() ) {
    
            $shortcode = '[vc_posts_grid loop="size:10|order_by:date|post_type:post"]';
            $content .= '<h4>Kleo Posts Grid</h4>';
            $content .= do_shortcode($shortcode);
        }
    
        return $content;
    
    }
    add_filter('the_content', 'CustomKleoAddContentAfterPost');
    
    

    You need to put this snippet to your kleo-child/functions.php

    Best Regards

    Radu

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #75010
     jonbrowne
    Participant
    This reply has been set as private.
    #75088
     Radu
    Moderator

    You need to put only the short code

    [vc_posts_grid loop="size:3|order_by:date|post_type:post|categories:3" post_layout="small" show_meta="no" show_excerpt="no" show_footer="no"]

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 4 posts - 1 through 4 (of 4 total)

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?