0

Not getting result

   Benefits Section
============================-->
<section id="services">
    <div class="container">

        <header class="section-header wow fadeInUp">
            <h3>
                6 reasons to choose Uitechnosoft
                <span>Our services are designed to give prime quality product which suits the client needs</span>
            </h3>
        </header>

        <div class="row">
            <?php
            $args1 = array('posts_per_page' => -1,
               'category' => 116,
                'post_type' => 'post',
                'numberposts' => -1
            );
            $catPost1 = get_posts($args1);
            //$catPost = get_posts(get_cat_ID("homeService"));
            foreach ($catPost1 as $post) : setup_postdata($post); ?>


                <?php if (has_post_thumbnail($post->ID)): ?>


                    <div class="col-lg-4 col-md-6 box wow bounceInUp" data-wow-duration="1.4s">


                            <h4 class="title"><?php the_title(); ?></h4>
                            <div class="description"><?php the_content(); ?></div>


                    </div>
                <?php endif; ?>
            <?php endforeach;
            wp_reset_postdata();?>
        </div>

    </div>
</section><!-- #Benefits -->

Using same code but getting the result for other category

  Services Section
============================-->
<section id="services">
    <div class="container">

        <header class="section-header wow fadeInUp">
            <h3>
                We help you to Grow your Business
                <span>Complete Web Solution</span>
            </h3>

            <p>
        </header>

        <div class="row">
            <?php
            $args = array('posts_per_page' => -1,
                'offset' => 1,
                'category' => 2,
                'numberposts' => -1
            );
            $catPost = get_posts($args);
            //$catPost = get_posts(get_cat_ID("homeService"));
            foreach ($catPost as $post) : setup_postdata($post); ?>


                <?php if (has_post_thumbnail($post->ID)): ?>
                    <?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'single-post-thumbnail'); ?>

                    <div class="col-lg-4 col-md-6 box wow bounceInUp" data-wow-duration="1.4s">
                        <a href="<?php echo get_post_meta($post->ID, 'Page_URL', true); ?>">
                            <div class="icon"><img src="<?php echo $image[0]; ?>" alt="<?php the_title(); ?>"/></div>
                            <h4 class="title"><a href="<?php echo get_post_meta($post->ID, 'Page_URL', true); ?>"><?php the_title(); ?></a></h4>
                            <div class="description"><?php the_content(); ?></div>
                            <p class="description"><a href="<?php echo get_post_meta($post->ID, 'Page_URL', true); ?>">Learn More</a></p>
                        </a>
                    </div>
                <?php endif; ?>
            <?php endforeach;
wp_reset_postdata();                ?>
        </div>

    </div>
</section><!-- #services -->
  • try to add 'post_type' to the arguments of the second query. – Michael Sep 23 '19 at 20:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.