Forums

Cat List links to Cat Main? (2 posts)

  1. The_ROb
    Member
    Posted 3 years ago #

    I'm confused. I wrote the following script for a project awhile back that pulled and listed movies within a certain genre (category). I copied the code but what's happening is it's linking to the front page of the category. It lists the sub cats but the permalinks are all the same. Hopefully someone can help with the code below OR possibly provide a better solution for listing posts under a specific category.

    code:

    <div class="menu">
    <?php $posts = get_posts( "category=" . 2 . "&numberposts=2" ); ?>
    <?php if( $posts ) : ?>
    <a href="#aboutus" class="menuitem top">Action</a>
    <div class="menu">
    <?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
    <a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title(); ?>" class="menuitem"><?php the_title(); ?></a>
    <?php endforeach; ?>
    </div>
    <?php endif; ?>
    </div>

    thx

    rob

  2. The_ROb
    Member
    Posted 3 years ago #

    So that no one thinks i'm being lazy, you all should know I've searched and searched and came up with no solutions.

    I've tried the solutions posted
    Here(support/topic/50315/page/2?replies=38)
    Here(support/topic/79263?replies=3) and
    Here(codex.wordpress.org/Category_Templates)

    Nothing is changing.

    To give a little more info. I'm making a menu listing top level categories are buttons and having a drop down menu list the posts within that particular category. The post titles list but all link to the top level category.

    Also something odd in the source that might be helpful:
    <a href="http://MYSITE/aboutus.html">LeaderShip Team<!--enpte-->" class="menuitem"><!--enpts-->LeaderShip Team<!--enpte--></a>

    Anyone know where '<!--enpts-->' comes from?

Topic Closed

This topic has been closed to new replies.

About this Topic