WordPress.org

Ready to get started?Download WordPress

Forums

blix single category page comments (11 posts)

  1. docflo
    Member
    Posted 8 years ago #

    Okay, I've been searching for the solution of this little problem for hours now. Can't find it here, can't find it elsewhere. Probably doesn't help that i'm a php-n00b.
    I installed the beautiful blix template. I created a page that displays only one category. It looks like this:
    doktorflorian.com/werk
    Note that there is no option to post a comment beneath the individual posts, even though I have
    <?php comments_popup_link('schreib was', '1 kommentar', '% kommentare', 'commentlink', ''); ?>

    in my template for this page.
    The whole code looks like this:
    <?php
    /*
    Template Name: werk
    */
    ?>

    <?php get_header(); ?>

    <!-- content ................................. -->
    <div id="content" class="archive">

    <?php
    $posts = get_posts('numberposts=8&category=4');
    foreach($posts as $post) :
    setup_postdata($post);
    ?>
    <div class="entry">
    <h2>" title="Permalink"><?php the_title(); ?></h2>
    <?php the_content(); ?>
    <p class="info">
    <?php comments_popup_link('schreib was', '1 kommentar', '% kommentare', 'commentlink', ''); ?>
    <em class="date"><?php the_time('F jS, Y') ?><!-- at <?php the_time('h:ia') ?>-->
    <!--<em class="author"><?php the_author(); ?>-->
    <?php edit_post_link('Edit','<span class="editlink">','</span>'); ?>

    </div>
    <?php endforeach; ?>
    </div><!-- /content -->
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    I would like this page to look exactly like this:
    doktorflorian.com/category/werk/
    I would also like it to have "previous posts" and "next posts" buttons on the bottom, but I can insert the necessary code anywhere in my "werk" page template, the buttons still won't show.
    Please help me understand what I am doing wrong.

  2. moshu
    Member
    Posted 8 years ago #

    What is the reason you want to have a Page that is basically a "copy" of your category view?

  3. docflo
    Member
    Posted 8 years ago #

    In the blix theme all pages appear in the top navigation bar. I want all entries from one category to be accessed by a button in the top navigation bar.

  4. katie1
    Member
    Posted 8 years ago #

    It would be nice if I actually commented on the right query post... [sigh]...

    Ok. I'm assuming that you want to have commenting on your page, and that your page isn't really a page, but a post?

    From what I've read these last four weeks, the ability to comment on a page isn't something that's available to us.

    Commenting on a post I believe is fine. Can you clarify if your page is a page or if its a post? I'm using Blix myself, so I might be able to help you out some.

  5. docflo
    Member
    Posted 8 years ago #

    well... i have a page that contains posts from a certain category. i want the individual posts to display just like they do on my front page and in the archive, i.e. with the ability to comment on every post and to see the number of comments that have already been left. even though i have inserted the aproppriate code into my page template, i do not get the commentlink to display. also i would like to have navigation buttons for previous posts and newer posts to this category on the bottom of my page.

  6. katie1
    Member
    Posted 8 years ago #

    Ok. So posts it is...

    Like I mentioned before, I'm using Blix myself, heavily hacked to suit my needs. You can find it here Strictly Romance

    (Please note that this site is still under design mode, so there's alot of dummy text in places to remind me where things have to go. So please excuse the mess) :)

    When I looked at your website yesterday, I checked out via "source view" and noticed that for each "entry" you have you don't have the appropriate comment code - whilst you are calling it php style, you're not calling it css/html style.

    In my entry section I have the following:

    <div class="entry">
    <h2>Whatever</h2>
    <p class="byline"><span>by </span><?php the_author(); ?>
    <p class="date"><?php the_time('F jS, Y') ?><?php ($post->post_excerpt != "")? the_excerpt() : the_content(); ?>
    <p class="info"><?php if ($post->post_excerpt != "") { ?>" class="more">Continue Reading<?php } ?><?php comments_popup_link('Add comment', '1 comment', '% comments', 'commentlink', ''); ?><!--print/">Print This Article--><!--<?php the_time('h:ia') ?>--><!--<?php edit_post_link('Edit','<span class="editlink">','</span>'); ?>-->

    You'll notice that in this section the call for "continue reading" & "commenting" and other misc stuff reside.

    In your page it didn't have this html code call. Perhaps if you inserted this as shown, to match your own p class='info' and closed with a div and then inserted Blix's css code into your style sheet taking care to track where your images are, this will work. Try it and see - it can't hurt.

    For the previous posts, that too is in the index.php file. Scan down on the original index.php in the Blix folder and you'll see :

    <?php endwhile; ?>
    <!-- this is ugly -->
    <span class="next"><?php previous_posts_link('Next Posts') ?></span>
    <span class="previous"><?php next_posts_link('Previous Posts') ?></span>

    The first thing I tend to do when hacking a template is to create a copy and put the original away in a safe place, just in case I stuff things up. If I do, stuff things up, all I have to do is go to the original source template file and selected the file replacement, make another copy and insert it into my site to hack away at.

    Hope this helps.

  7. docflo
    Member
    Posted 8 years ago #

    if you look at my code example above, you can see that i did include the calls for html. in fact my code looks almost exactly like what you did. and still no commentlinks and no previous/next post links.

  8. docflo
    Member
    Posted 8 years ago #

    plus i think this forum screws up the code...
    for example this seems wron to me:
    <p class="info"><?php if ($post->post_excerpt != "") { ?>" class="more">Continue Reading<?php } ?>

  9. katie1
    Member
    Posted 8 years ago #

    It's not wrong - I'm using the html call & php coding for inserting excerpts into my posts when I first write them in Write / Post admin section.

    When the post is published to a page, it shows only the title and snippet of my post, not the whole post itself. So that's why there's the excerpt php coding in the "info" tag.

    As for the continue reading part, that allows people to click on it and they're re-directed to the "whole" post for more reading.

    As for your problem, I can't think of why it doesn't work, unless you haven't enabled commenting in your admin section : discussions / comments. But I'd reckon you would have done that. The only other possiblity is when you look at index.php it has a little snippet:-

    <?php if ($post->comment_status == "open") ?>

    When you made your new page, did it include this call?
    Sorry I can't be more assistance.

  10. docflo
    Member
    Posted 8 years ago #

    this is what's so frustrating for me: i inserted exactly the same code as in index.php and still it looks different. i don't get it...

  11. docflo
    Member
    Posted 8 years ago #

    okay, i got a little step closer to what i want to achieve by inserting my code into a new loop:

    http://codex.wordpress.org/The_Loop#Multiple_Loops_Example_1

    but still no previous/next navigation at the bottom.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags