• Resolved DailyMeals

    (@dailymeals)


    I am trying to have all post from one category automatically redirect to one of my tabs/pages. I have tried the following. 1.copying my page.php and creating a new page template looking like this
    <?php
    /*
    Template Name: Farm Page
    */
    ?>
    <?php get_header(); ?>
    <?php query_posts(‘cat=86’); ?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <div class=”post-box page-box”>
    <div class=”post-header”>
    <h1 class=”pagetitle”><?php the_title(); ?></h1>
    </div><!–end post-header–>
    <div class=”entry page clear”>
    <?php the_content(); ?>
    <?php edit_post_link(__(‘Edit This’,'<p>’,'</p>’, ‘paperpunch’)); ?>
    <?php wp_link_pages(); ?>
    </div><!–end entry–>
    </div><!–end post-box–>
    <?php endwhile; /* rewind or continue if all posts have been fetched */ ?>
    <?php comments_template(”, true); ?>
    <?php else : ?>
    <?php endif; ?>
    </div><!–end content–>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Are there things here I just havent done properly here?
    I have also tried a redirect plugin, but that doesnt work either! Could this be an issue with my template? So confused! Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Are you comfortable editing your site’s .htaccess file? If so, I would try a redirect there.

    RedirectMatch 301 /category/your-cat-name/?$ http://www.domain.com/your-page/

    What this does is tells the browser that the page http://www.domain.com/category/your-cat-name/ (with or without the trailing slash) has permanently moved to the URL http://www.domain.com/your-page/

    If you have never edited an .htaccess before, please be very careful as you can seriously mess up your site if it’s improperly done. Be sure to download your current .htaccess file and add to it, so you don’t overwrite the .htaccess directives that WordPress uses. Edit in a plain-text editor only and be sure not to add any blank lines anywhere.

    Thread Starter DailyMeals

    (@dailymeals)

    Thanks! I can give it a try, but it does sound a bit daunting so I’m open to other suggestions as well. Everything I’ve read makes it seem as if creating a new page template should be simple, but I think Im missing something:)

    Creating a page template is fairly easy, but it won’t accomplish this:

    I am trying to have all post from one category automatically redirect to one of my tabs/pages.

    There is a redirection plug-in, but there are a lot of reports that it doesn’t work with upcoming v. 3.1:

    http://wordpress.org/extend/plugins/redirection/

    It also occurred to me that some hosting control panels also offer a GUI to do redirects if you’re not comfortable editing your .htaccess directly, so you should check yours.

    Thread Starter DailyMeals

    (@dailymeals)

    Problem solved! Found the “inline Posts” plugin here http://aralbalkan.com/1016 and it works perfectly, so I can just add whatever posts I want to any page.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to redirect a category to a WP Page’ is closed to new replies.