I am having great difficulty with a wordpress site. I am trying to call information from a page that is a sub-page to 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 store.
- The categories. Sub-pages of the store.
-- The products. Sub-pages of the categories.
Throughout the entire site I call a sidebar 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" heading. This would display, as a link, the title of the newest sub-page of a design category. As well as an image defined by a custom field labeled "Product_Image".
Unfortunately I do not know how to call from the newest sub-page of a specific parent.
In short I want to basically say "Get me the title and custom field from the newest child-page of the Design page (ID=22)"
As you can tell I am new to PHP and have I am only just beginning to learn PHP from this website and Lynda.com PHP essentials.
Could anyone help please?
Also as a side note is there a way to add a marker to a product page. I was thinking of having an "item of the week". By somehow marking a product page, perhaps via custom field, its information (title, image and a link) is then displayed on the homepage. I can then remove the marker and add it a different product page so the featured product can be changed week by week.
I found this which displays the most recently created pages. This is the original code, but I have modified the one on my site to only display the title and image.
However I do not know how to modify it so rather than showing the most recently created pages on the whole site, it only shows the most recently created child page of my design page.
I have now got the answer to my question. For anyone who reads this and is struggling with the same thing then just add the following code to the initial argument.
'post_parent' => '22'
(replace 22 with the page id of the parent)
The rest of the code stays the same. so it now becomes
$args=array(
'showposts'=>5,
'post_type' => 'page',
'caller_get_posts'=>1,
'post_parent' => '22' //replace 22 with the page id of the parent.
);
Remember to add a , (comma) to the line before so the code knows 'post_parent' is a new argument.
Hi people,
I am having great difficulty with a wordpress site. I am trying to call information from a page that is a sub-page to 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 store. - The categories. Sub-pages of the store. -- The products. Sub-pages of the categories.
Throughout the entire site I call a sidebar 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" heading. This would display, as a link, the title of the newest sub-page of a design category. As well as an image defined by a custom field labeled "Product_Image".
The design page has a page id of 22.
I know the code to display it is:
Unfortunately I do not know how to call from the newest sub-page of a specific parent.
In short I want to basically say "Get me the title and custom field from the newest child-page of the Design page (ID=22)"
As you can tell I am new to PHP and have I am only just beginning to learn PHP from this website and Lynda.com PHP essentials.
Could anyone help please?
Also as a side note is there a way to add a marker to a product page. I was thinking of having an "item of the week". By somehow marking a product page, perhaps via custom field, its information (title, image and a link) is then displayed on the homepage. I can then remove the marker and add it a different product page so the featured product can be changed week by week.
Off the top of my head, I don't think you can pull in pages based on date.
I found this which displays the most recently created pages. This is the original code, but I have modified the one on my site to only display the title and image.
However I do not know how to modify it so rather than showing the most recently created pages on the whole site, it only shows the most recently created child page of my design page.
<?php the_time('m.d.y') ?> " rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
Any help would be appreciated.
I have now got the answer to my question. For anyone who reads this and is struggling with the same thing then just add the following code to the initial argument.
(replace 22 with the page id of the parent)
The rest of the code stays the same. so it now becomes
Remember to add a , (comma) to the line before so the code knows 'post_parent' is a new argument.