• Hey, so I need some advice on this php I’m trying to use on a products page. (I’m new to this)

    I’ve written this so far…

    <?php
    $productCats = get_categories(?'child_of' => 3?); //the ID of the parent category
    foreach($productCats as $productCat) {
    	echo	'<article class="item">
    			<a href="#"><img src="#" alt=" " />
    			<h2>' . $category->name . '</h2></a>
    			<p>' . $category->description . '</p>
    		</article>' ;
    } ?>

    I have specific pages for each instance of $productCat to link to. How should I go about doing that?

    I was thinking there might be a way to utilize the Order Page Attribute in some way?

    Thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter bphil00

    (@bphil00)

    oh, also I was planning on using a plug-in to assign a thumbnail image to each category, for use in this php code. Any recommendations?

    Please view my site and Can you give a comment for it?? H?c SEO

    Thread Starter bphil00

    (@bphil00)

    update:

    okay, what about this?

    <?php
    $productCats = get_categories( 'child_of' => 3 ); //the ID of the
    parent category
    foreach($productCats as $productCat) {
      echo '<article class="item">
                          <a href="products/' . $productCat->slug .
    '.php"><img src="images/categoryThumbs/' . $productCat->slug . '.jpg"
    alt=" " />
                          <h2>' . $productCat->name . '</h2></a>
                          <p>' . $productCat->description . '</p>
                  </article>' ;
    }
    ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘categories > products’ is closed to new replies.