Forums

Making "Pages" act like "Categories" (snippets need to include Article Image) (3 posts)

  1. mwilliamsii
    Member
    Posted 4 months ago #

    Hi this is the page I am creating: http://ecologicmall.com/main/

    The links listed across the top are "pages" but I have named them to reflect the nine categories I'd like displayed there. The "Stores" link in the sidebar are "true" Wordpress Categories and will be deleted from the sidebar once the menu bar works correctly. When you click on "Baby" in the sidebar categories ( http://ecologicmall.com/main/archives/category/baby ) , recent Baby posts are displayed (Example Baby Post) but no article image. When you click on "Baby" in the menu bar across the top of the page ( http://ecologicmall.com/main/baby ) , a

      is displayed showing the titles of some recent Baby posts.

      What I'd like to do is have the menu bar across the top to display information like the categories currently do, as post "previews" rather than an

      of recent posts, and with an addition of the preview article image after the post title but before the post preview text.

      When you click on Baby in the menu bar across the top, it should have a similar look to the main blog page, ( http://ecologicmall.com/main/ ) in that previews of posts are displayed WITH an image (Post Title, a main Post article image, and about 8 lines of preview text before the "Read More" link is displayed.

      Right now I'm having some problems getting the posts' preview images to show up on the Categories pages, which preview the articles in that category. Can I get the Categories to display the Title, Article Image, and Article Text Preview, and then can I also set up the menu bar to accept those Wordpress categories as links?

      ***Redundant, but I wanna be thorough in all that I mentioned above: Is there a way to set up the current menu bar to display the Category titles instead of Page titles and then link to a listing of all recent posts within that category, in the style of the main page, which includes the Post Title, the Article's main image, and 8-10 lines of preview article text before the "Read More" bump. Even moreso, can I limit the number of recent posts displayed on those Pages (like 10 recent posts snippets are shown with an article image, and the end of the page "read older articles" or something similar is displayed to read older posts.)

  2. esmi
    Member
    Posted 4 months ago #

    Not sure I followed all of the above but is wp_list_categories what you're looking for?

  3. dbmartin
    Member
    Posted 4 months ago #

    You can create Pages with custom LOOPS that only pull posts tagged with a particular tag and/or only with a particular category.

    So, the Baby Page would only pull posts tagged with "baby" or only pull posts in the category "Baby".

    Like so:

    This section here will display whatever you type in the Editor when making the Page:
    <?php if (have_posts()) : ?>
    	<?php while (have_posts()) : the_post(); ?>
    		<div class="post" id="post-<?php the_ID(); ?>"> <!-- post -->
    			<h1><?php the_title(); ?></h1>
    			<?php the_content(); ?>
    		</div> <!-- /post -->
    	<?php endwhile; ?>
    
    This will display only the posts tagged with 'baby':
    <?php
    // Query posts, pulling only those tagged 'baby'
    $post_query = new WP_Query('tag=baby');
    if ($post_query->have_posts()) : while ($post_query->have_posts()) : $post_query->the_post(); ?>
    	<div class="post" id="post-<?php the_ID(); ?>"> <!-- post -->
    		<h2><?php echo get_the_title(); ?></h2>
    		<?php echo get_the_content(); ?>
    	</div>  <!-- /post -->
    <?php endwhile; endif; ?>
    
    This will display if there's nothing to display	:
    <?php else : ?>
    	<h2 class="center">Not Found</h2>
    	<p class="center">Sorry, but you are looking for something that isn't here.</p>
    	<?php get_search_form(); ?>
    <?php endif; ?>

Reply

You must log in to post.

About this Topic

Tags

No tags yet.