I am a newbie so apologize if it’s not an easy question to figure out. I need to add a read more button into a portfolio gallery (divided in categories) – working in wordpress. I have a plugin called Ajax Read more and this short code: [ajax_load_more post_type=”portfolio” posts_per_page=”4″ offset=”3″]
but it shows all the portfolio posts in all the categories, and doesn’t follow the css rules. Where and how should I wrote this on the php file?

This is the part of the php file (I think it should go somewhere over here):

<div class="col-xs-<?php if ($mt_layout != "full") { echo "8 "; } else {  echo "12 "; } echo $mt_float_layout; ?> ">

    <?php if($categorys=="" and $menu=="sorting"){ ?>

        <?php $term_obj = get_terms('portfolio_cat'); ?>

        <ul id="filterm">

            <li class="current"><a href="#" data-filter="*" id="showall" class="selected close-subnav filter-item">All</a></li>

            <?php foreach ($term_obj as $term) { ?>

                <li><a href="#<?php echo $term->slug; ?>"  <?php if ($term->slug == 'photos') {?> class="show-subnav filter-item" <?php } else {?>class="close-subnav filter-item" <?php }?>id="<?php echo $term->slug; ?>" data-filter=".<?php echo $term->slug; ?>"><?php echo $term->name; ?></a></li>

            <?php } ?>

        </ul>

        <div class="clear"></div>

    <?php } ?>

 <div class="post-box2 row"> 

                if( ! empty($category)) { 
                    $loop = new WP_Query(array(
                        'post_type'=> 'portfolio',
                        'tax_query' => array( array( 'taxonomy' => 'portfolio_cat', 'field' => 'id', 'terms' => $category )),
                        'posts_per_page' => $count,
                        'orderby'  => array( 'meta_value_num' => 'DESC',),
                        'meta_key' => 'rating_stars'
                    )); 
               } else {
                    $loop = new WP_Query(array(
                        'post_type'=> 'portfolio',
                        'posts_per_page' => $count, 
                        'field' => 'slug',
                        'paged' => get_query_var( 'paged' ),
                        'orderby'  => array( 'meta_value_num' => 'DESC',),
                        'meta_key' => 'rating_stars'
                    ));
                }
                    $portfolio_layout_style = "default";


                $i = 0; 
                while ( $loop->have_posts() ) : $loop->the_post();
                        global $post, $more;
                        $more = 0;
                        $term_obj =  wp_get_object_terms($post->ID, 'portfolio_cat');
                        $portfolio_title = $post->post_title;
                        $portfolio_taxonomy = get_the_term_list($post->ID, 'portfolio_cat', '', ' ', '' );
                        $portfolio_taxonomy_format = preg_replace('/<a(.*)>(.*)</a>/iU', '<li>$2</li>', $portfolio_taxonomy);
                        $terms_as_text = strip_tags( get_the_term_list( $post->ID, 'portfolio_cat', '', ' ', '' ) );
                        $portfolio_title = $post->post_title;
                        $get_text=get_post_meta($post->ID, "madza_portfolio_hover_text", true);
                        $slides = get_post_meta($post->ID,'slides', true);
                        $thumb = get_post_meta(get_the_ID(), 'tz_portfolio_thumb', TRUE); 
                        $large_image_lightbox = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large');
                        $lightbox = get_post_meta(get_the_ID(), 'tz_portfolio_lightbox', TRUE); 
                        $portfolio_caption = get_the_excerpt();    
                        $src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), array( 999, 999 ));
                                                                              $title = get_the_title();

Read more here: Short code into PHP


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: