Defining Child Pages Using Custom Field & Output as Boxes (3 posts)

  1. klj
    Posted 3 years ago #

    Afternoon All.

    I am currently developing a new site for my company and I've used WordPress for many years as I find it very flexible and it tends to be adaptable to most situations I need. I have on this project hit a snag.

    The site is:

    What I am trying to achieve is to be able to enter page id's into a custom field in the CMS and then have those pages displayed as boxes which the user can click on to go to a list of products very much similar to an ecommerce website.

    The company only sells to distributers and not to Jo Public so an ecommerce site wasn't really needed which is why I used WordPress.

    Has anyone come across a Plugin or code that gives this kind of functionailty? I am a designer rather than a coder which is why I am having difficulties. I can get it to list the id's I need but it then goes farther and lists all the other pages on the site.

    My code for this page is:

    		Template Name: Category Page
    <?php get_header(); the_post(); ?>
    <div id="content">
    		echo "<div class='category_box'>";
    		while (have_posts()) : the_post(); ?>
    		<a href="<?php the_permalink(); ?>" class="categories" title="<?php the_title(); ?>">
            <div class="category_name">
            	<h2><?php the_title(); ?></h2>
            </div><!-- end .category_name -->
    		<div class="category_image">
              	<?php echo "<img src='" . get_post_meta($post->ID, "image", true) . "' />"; ?>
            </div><!-- end . category_image -->
    		<?php endwhile; wp_reset_query();
    		echo "</div>";
    </div><!-- end #content -->
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Any help or suggestions would be gratefully received.



  2. codingpet
    Posted 3 years ago #


    This is the custom query you wrote. The query is incorrect because all pages will be selected and display.

    For products, I suggest you use custom post type on http://codex.wordpress.org/Post_Types Create a custom posts type e.g. products to manage all products will be better.

    If you don't want to check codes, this plugin maybe helpful.

  3. klj
    Posted 3 years ago #

    Hi codingpet.com

    Thanks for the suggestions. Will give them a go and see how I get on. New to coding but eager to learn.

    Many Thanks

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.