Forums

Pretty permalinks work on Pages, but not on Posts page (4 posts)

  1. tracyberna
    Member
    Posted 2 years ago #

    A client of mine is having trouble with what I put in the title: pretty permalinks work for every page but the one she's designated for posts, which still generates a page id URL.

    Her custom permalink structure is /%category%/%postname%/ In practice this seems to generate a URL of "sitename.com/pagetitle," since, as we know, pages don't have categories. Her posts page also comes out without a category in front of it, just the page id.

    Her sidebar code is this:

    <div id="right">
    <a href="http://www.domain.com/" id="nav-home" class="box_right_top">Home</a>
    <a href="http://www.domain.com/?page_id=3"  id="nav-about" class="box_right_top">About Margaret</a>
    <a href="http://www.domain.com/page_id=60"  id="nav-articles" class="box_right_top">Articles</a>
    <a href="http://www.domain.com/?page_id=5"  id="nav-publications" class="box_right_top">Publications</a>
    <a href="http://www.domain.com/poetry-and-plays/"  id="nav-poetry" class="box_right_top">Poetry and Plays</a>
    <a href="http://www.domain.com/?page_id=7"  id="nav-events" class="box_right_top">Events</a>
    <a href="http://www.domain.com/?page_id=9"  id="nav-radioshows" class="box_right_top">Radio Shows</a>
    <a href="http://www.domain.com/?page_id=11"  id="nav-studio" class="box_right_top">Studio History</a>
    
       <br /> <br />
    <?php
    if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Simple Top Nav') ) : ?>
    <!--YOUR OLD NAVIGATION -->
    <?php
    endif;
    ?>
    </div>

    Can anyone tell me what might be the problem?

  2. Michael Fields
    Theme Wrangler
    Posted 2 years ago #

    The problem is that you have all of the links in the "right" div hard-coded in you html. You will want to use the get_permalink function.

    Instead of:

    <a href="http://www.domain.com/?page_id=3" id="nav-about" class="box_right_top">About Margaret</a>

    Use:

    <a href="<?php get_permalink( 3 ); ?>" id="nav-about" class="box_right_top">About Margaret</a>

  3. tracyberna
    Member
    Posted 2 years ago #

    Okay, I just gave that a try - I copied and pasted from your example - and the result just sent me back to the home page. It returned the URL "www.domain.com" with nothing after it.

    But hard-coding still might be the problem - anything else I could try?

  4. Michael Fields
    Theme Wrangler
    Posted 2 years ago #

    Opps. There was a small oversight in my code. Please try this one:

    <a href="<?php print get_permalink( 3 ); ?>" id="nav-about" class="box_right_top">About Margaret</a>

Topic Closed

This topic has been closed to new replies.

About this Topic