apax27
Forum Replies Created
-
Forum: Themes and Templates
In reply to: Listing Links to All Pages Using A Particular TemplateThank you! I am determined/desperate to figure this out!! Too many of these posts get left unresolved and hopefully this will help someone in the future as well.
So I tried:
$query = new WP_Query( array( 'meta_key' => 'wp_page_template', 'meta_value' => 'product.php'
based on the instructions in that link and it did not return any results. Was I using it wrong?
Bumping this post. I am desperate for an answer. I have been trying to figure this out for months and searched everywhere!!
Forum: Themes and Templates
In reply to: Listing Links to All Pages Using A Particular TemplateStill open-ended on this. Anyone out there know how to make this array work on child pages???
Thanks for responding!
Here’s where you lost me:
2. Build index.
what does that mean?
Let’s start at the beginning. Is this plugin supposed to replace the wordpress search bar? Do I need to replace the php code where the search bar is in order to make it work?
All I am trying to do is limit my search to specific pages on my site
I am sure once I figure out the basics first, I can figure out how to do that. But there is nothing that tells you the basics. After installing the plugin, what is the next step to adding this search on my site?
Thanks!!
anyone?
Forum: Themes and Templates
In reply to: Listing Links to All Pages Using A Particular TemplateIgnore my last reply
I finally figured out why it wasn’t working. But still frustrated because I can’t figure out the fix.
All of the pages with the template product.php have parent pages. So I changed one of the pages to “no parent” and lo and behold- the array returned that page title in its result.
So this only works on pages that have no parent! The problem is- the pages in this template need to have parents for the structure of site.
I feel like I am so close to figuring this out yet so far!!!
I appreciate you taking the time to help me. Sorry for disappearing- I had been spending too much time on this site and neglecting my other clients. You are a good person for volunteering your time to help clueless people like me π
Forum: Themes and Templates
In reply to: Listing Links to All Pages Using A Particular TemplateSorry for dissapearing.
I think I have figured out a bug w/ WordPress.
I have 2 templates, product.php and product-category.php
I also have business.php and business-category.php.
Those 4 templates do not work with the above code. But other templates will work, such as homepage.php or location.php I think because both templates have the word “product” in them, it doesn’t know which one to return. I am going to try changing the name of the template and will keep you updated.
Forum: Themes and Templates
In reply to: Listing Links to All Pages Using A Particular TemplateThat is so weird- yes I am 100% positive. I double checked even to see if there were any other template pages with the same name and there is only one with the template name Product and that is product.php. There are over 300 pages with this template. I even tried the same code with other template files to check it and they didn’t work either
Forum: Themes and Templates
In reply to: Listing Links to All Pages Using A Particular Templatearray(0) { }
Forum: Themes and Templates
In reply to: Listing Links to All Pages Using A Particular TemplateHi I am sorry for being such a newbie. Can you tell me where to put that? Never feel like you’re being too specific or assume that I know what you’re talking about because I most likely don’t! π thanks
Forum: Themes and Templates
In reply to: Listing Links to All Pages Using A Particular TemplateMy fault- I pasted it after playing around with it after getting the error. This was your code
<?php $product_pages_args = array( 'meta_key' => '_wp_page_template', 'meta_value' => 'product.php' ); $product_pages = get_pages( $product_pages_args ); ?> <div class="category-listing"> <ul> <?php foreach ( $product_pages as $product_page ) { echo '<li><a href="' . get_permalink( $product_page->ID ) . '">' . $product_page->post_title . '</a></li>'; } ?> </ul> </div>
Forum: Themes and Templates
In reply to: Listing Links to All Pages Using A Particular TemplateI’m confused- that is the code you posted. I copied and pasted. The only thing I changed was the <?ul> to because I assumed that was a typo.
Forum: Themes and Templates
In reply to: Listing Links to All Pages Using A Particular Template<?php $args = array( 'meta_key' => '_wp_page_template', 'meta_value' => 'product.php' ); foreach($args as $page) { $content = $page->post_content; ?> <div class="category-listing"> <ul> <?php foreach ( $product_pages as $product_page ) { echo '<li><a href="' . get_permalink( $product_page->ID ) . '">' . $product_page->post_title . '</a></li>'; } ?> </ul>
Something seems wrong. I am getting an error:
Warning: Invalid argument supplied for foreach() in …Forum: Themes and Templates
In reply to: Listing Links to All Pages Using A Particular Template<?php $args = array( 'meta_key' => '_wp_page_template', 'meta_value' => 'product.php' ); foreach($args as $page) { $content = $page->post_content; ?>
This does not work. But I feel like I might be on the right track.
Forum: Plugins
In reply to: get_pages() where templateSorry to reply to an old post…. but do you know how to do the opposite of this? (ONLY display from a specific template)