[Resolved] Display title and img from a sub-page that is not child to current page
Hi wordpress gurus.
I am having great difficulty trying to call information from a page that is a sub-page to another parent, and I was hoping someone would be able to help.
Basically I have built a website that as well as the usual home, about and content page includes a shop that which has 3 levels of hierarchy.
– The categories. Sub-pages of the store.
— The products. Sub-pages of the categories.
Throughout the entire site I call a sidebar
<aside>which displays the title and a snippet of the latest blog post and I’ve added a mailing list form. This bit I have done.
However I also want to add a “latest design” section. This would display as a link the title of the newest sub-page of a specific category. As well as an image defined by a custom field.
- The category title is Designs and has a page id of 22.
- Each product has an image defined using a custom field called
I know the code to display it is:
<a href="<?php the_permalink(); ?>"> <h3><?php the_title(); ?></h3> <?php echo "<img src='" . get_post_meta($post->ID, "Product_Image", true) . "' />"; ?> </a>
Unfortunately I do not know how to call from the newest sub-page of a specific parent. As you can tell I am new to PHP and have I am only just beginning to learn PHP from Lynda.com.
Could anyone help please?
Also as a side note is there a way to define a featured product. I was thinking of having an “item of the week” so the same info as above (title, image, permalink) can be called from a specified product page and displayed on the home page. But the featured product could then be changed from week to week?
- The topic ‘[Resolved] Display title and img from a sub-page that is not child to current page’ is closed to new replies.