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

  1. kvnmcwebn
    Posted 3 years ago #

    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

    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?

  2. Aaron
    Posted 3 years 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
    Posted 3 years ago #

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

    $featuredPosts = new WP_Query();
    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(); ?>
    <?php endwhile; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic