WordPress.org

Ready to get started?Download WordPress

Forums

category permlinks when blog is not on the homepage (3 posts)

  1. kvnmcwebn
    Member
    Posted 1 year ago #

    Hi,
    I have a static-ish age for the homepage and am wondering how to get my auto generated "read more" category post links to work from the homepage?

    All of the menu items I just put in manual links like this:

    <li class="catlist" >/category/about">ABOUT US

    Avellana
    here is the functions code:

    function excerpt_read_more_link($output) {
    global $post;
    return $output . '<a href="'. get_permalink($post->ID) . '"> Read More...</a>';
    }
    add_filter('the_excerpt', 'excerpt_read_more_link');

    I tried custom permlinks settings but that is restrictive. I'd like to do it in the functions file.
    Just any read more or category permlinks to have "category/" before the post name. What is the best way to do this?
    -thanks

  2. Aaron
    Member
    Posted 1 year ago #

    Little confused.

    What do you want the title to link to?
    What do you want the read more link to link to?

    Can you post your loop on page.php? Might be easier just to do it there?

  3. kvnmcwebn
    Member
    Posted 1 year ago #

    Hi good idea. Not sure how to do that. Here is the code that's pulling the articles on the homepage. thanks.

    <?php
    $featuredPosts = new WP_Query();
    $featuredPosts->query('showposts=1&cat=19');
    while ($featuredPosts->have_posts()) : $featuredPosts->the_post(); ?>
    <h2  style="margin-top:-10px;"><a class="newsletterheader" href="category/avellana-blog/"><?php the_title(); ?></a></h2>
    
    <div class="storycontent">
    <?php the_excerpt(); ?>
    </div>
    <?php endwhile; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic