Linking to just the post
-
hi,
I want to make my WordPress blog very simple, I have cateories and sub categories, at the moment I have STAFF – STAFF HANDBOOK when you click on STAFF HANDBOOK in the STAFF category, you have a link to read the post, I want to be able to read the main post straight away when I click on the sub category name
is there a way?
-
can anyone help me here please?
When you go to edit your post you should see all of your categories listed in the lower right. Your categories and sub-categories should be listed there. Check all the ones that relate to your post.
yes, I have done that but when I click that it then shows a link to my post so I have to click twice before I can view my post!
your theme might be using only linked post titles in the template file that displays your posts when you click on the category link (archive.php, or category.php).
you may need to edit this file to include ‘the_content();’ to show the full post.
yes I have archive.php file but my code which contains the_content(); is inside the Page Template(page.php) I am using the tehme Plainscape 1.0.3 by Srini G
here is the code for page.php
[code]
<?php get_header(); ?><div id="content">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2><?php the_title(); ?></h2>
<div class="entry">
<?php the_content('<p class="serif">Read the rest of this page »</p>'); ?><?php wp_link_pages(array('before' => '<p>Pages: ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
</div>
<div class="postmetadata">
<?php if( function_exists('the_tags') )
the_tags(__('Tags: '), ', ', '
');
?><?php if('open' == $post->comment_status) { ?><?php _e('Comment') ?> (<?php comments_rss_link('RSS'); ?>)<?php } ?>
<?php if('open' == $post->ping_status) { ?> | " rel="trackback"><?php _e('Trackback') ?><?php } ?>
<?php edit_post_link(__('Edit'), ' | ', ''); ?>
</div>
</div>
<?php comments_template(); ?>
<?php endwhile; endif; ?></div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
[/code]
what is the code of your archive.php?
there is a code button on top of this editor window – press that once before pasting your code, then again after.
for larger amounts of code, please use a https://wordpress.pastebin.com/
a link to your site might help as well.
this is my archive.php:
<?php get_header(); ?> <div id="content"> <?php if (have_posts()) : ?> <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?> <?php /* If this is a category archive */ if (is_category()) { ?> <h2>Archive for the ‘<?php single_cat_title(); ?>’ Category</h2> <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?> <h2>Posts Tagged ‘<?php single_tag_title(); ?>’</h2> <?php /* If this is a daily archive */ } elseif (is_day()) { ?> <h2>Archive for <?php the_time(get_option('date_format')); ?></h2> <?php /* If this is a monthly archive */ } elseif (is_month()) { ?> <h2>Archive for <?php the_time('F Y'); ?></h2> <?php /* If this is a yearly archive */ } elseif (is_year()) { ?> <h2>Archive for <?php the_time('Y'); ?></h2> <?php /* If this is an author archive */ } elseif (is_author()) { ?> <h2>Author Archive</h2> <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?> <h2>Blog Archives</h2> <?php } ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('« Older Entries') ?></div> <div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div> </div> <?php while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h3 class="post-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3> <div class="postmetadata">Posted on <?php the_time(get_option('date_format')) ?>, <?php the_time(get_option('time_format')) ?>, by <?php the_author() ?>, under <?php the_category(', ') ?>.</div> <div class="entry"> <?php the_excerpt(); ?> </div> <div class="postmetadata"> <?php if( function_exists('the_tags') ) the_tags(__('Tags: '), ', ', '<br />'); ?> <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?> | <a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title_attribute(); ?>"><strong>Read the rest of this entry »</strong></a></div> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('« Older Entries') ?></div> <div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div> </div> <?php else : ?> <h2 class="center">Not Found</h2> <?php include (TEMPLATEPATH . '/searchform.php'); ?> <?php endif; ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?>
this is my archives.php page
<?php /* Template Name: Archives */ ?> <?php get_header(); ?> <div id="content"> <div class="post"> <h2><?php _e('Archives') ?></h2> <h3><?php _e('Archives by Month') ?></h3> <ul> <?php wp_get_archives('type=monthly'); ?> </ul> <p> </p> <h3><?php _e('Archives by Subject') ?></h3> <ul> <?php wp_list_cats(); ?> </ul> <?php if( function_exists('wp_tag_cloud') ) { ?> <p> </p> <h3><?php _e('Tags') ?></h3> <?php wp_tag_cloud(); ?> <?php } ?> </div> </div> <?php get_sidebar(); get_footer(); ?>
my site is local only, sorry
in archive.php, find these lines:
<div class="entry"> <?php the_excerpt(); ?> </div>
and replace ‘the_excerpt();’ with ‘the_content(‘read more’);’:
<div class="entry"> <?php the_content('read more'); ?> </div>
hopefully, that should give you the full article when you click on the categorys.
thanks for trying to help, I did that and it’s still as it was
can anyone please help me here?
still unresolved?!
Can anyone please help me here?
Please help
That should have fix the problem. What’s the blog URL?
- The topic ‘Linking to just the post’ is closed to new replies.