0

I'm using this code to show my recent posts in my website:

<div class="post_content">
        <div class="home_posts">
            <?php
                $args2 = array(
                'post_type' => 'post',
                'posts_per_page' => 6,
                'order_by'=>'post_date',
                'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1),
                );
                $query = new WP_Query( $args2 );
                if ( $query->have_posts() ) :
                    while ( $query->have_posts() ) : $query->the_post();
                        echo '<div class="grid_post">
                                <h3><a href="'.get_permalink().'">'.get_the_title().'</a></h3>';
                        $type = get_post_meta($post->ID,'page_featured_type',true);
                        switch ($type) {
                            case 'youtube':
                                echo '<iframe width="560" height="315" src="http://www.youtube.com/embed/'.get_post_meta( get_the_ID(), 'page_video_id', true ).'?wmode=transparent" frameborder="0" allowfullscreen></iframe>';
                                break;
                            case 'vimeo':
                                echo '<iframe src="http://player.vimeo.com/video/'.get_post_meta( get_the_ID(), 'page_video_id', true ).'?title=0&amp;byline=0&amp;portrait=0&amp;color=03b3fc" width="500" height="338" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
                                break;
                            default:
                                echo '<div class="grid_post_img">
                                            <a href="'.get_permalink().'">'.get_the_post_thumbnail().'</a>
                                        </div>';
                                break;
                        }
                        echo '<div class="grid_home_posts">
                                    <p>'.dess_get_excerpt(120).'</p>
                                </div>
                            </div>
                            ';
                    endwhile;
            ?>
    </div>

However, it shows the posts from my "beauty" section. Also, I found that in that page, there is this code:

[posts-for-page cat_slug='beauty' hide_images='false' num='10' read_more='
Read More »' show_full_posts='false' use_wp_excerpt='true' strip_html='true'     
hide_post_content='false' show_meta='false' force_image_height='200'  
force_image_width='250']

Do you know how to change it, please? This is my website: www.wha2wear.com

1 Answer 1

1

Looks like you have the Posts for Page plugin installed. I don't know where you have put that code you mention, but the page is generated by the shortcode, which says that output should be limited to the beauty category. You probably don't need to write code yourself. Read the manual of the plugin and change the shortcode accordingly.

1
  • thank you! you are right, I just changed posts-for-page cat_slug='beauty' by posts-for-page order_by='date' and it works :)
    – Wha2wear
    May 8, 2016 at 5:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.