ngplayground
ngplayground

Reputation: 21647

Wordpress get_terms for post instead of category

Currently using the following to show up specific Categories set up by WooCommerce but I would like to have another piece of script to show me specific Pages inside WordPress.

<?php $catTerms = get_terms('product_cat', array('hide_empty' => 0, 'orderby' => 'ASC', 'include' => '18, 15, 17, 16')); ?>
    <?php foreach($catTerms as $catTerm) : ?>
        $thumbnail_id = get_woocommerce_term_meta( $catTerm->term_id, 'thumbnail_id', true );
        $image = wp_get_attachment_url( $thumbnail_id );
    ?>
    <li>
        <a href="/<?php echo $catTerm->slug; ?>">
            <div class="title"><?php echo $catTerm->name; ?></div>
            <img src="<?php echo $image; ?>">
            <p><?php echo $catTerm->description; ?></p>
        </a>
    </li>
<?php endforeach; ?>

I tried changing product_cat to page and post but still no luck at getting this to show me a loop of specific page content.

Upvotes: 0

Views: 301

Answers (1)

NLSaini
NLSaini

Reputation: 257

you use get_pages(); function to get pages like http://codex.wordpress.org/Function_Reference/get_pages

Upvotes: 2

Related Questions