• Resolved rufaswan

    (@rufaswan)


    I was wondering can I customize a page template to display all post under one specific category only.

    Then the post will have excerpted content (said 20 words) below the title.

    And the most important part is all post displayed must be sorted alphabetically, according to title.

    And that’s about it.

    P/S I was able to find this link, but I have no clue how to customize it
    http://wordpress.org/support/topic/112230?replies=2

Viewing 15 replies - 1 through 15 (of 17 total)
  • Forget Page as in Pages. That’s a different thing.
    All you need is here: Category_Templates

    And clicking on a category name will always display ONLY posts from that category, it is done out of the box by WP.

    Thread Starter rufaswan

    (@rufaswan)

    Well moshu, the page I’m trying to do is something like when you clicked on the “categories” or “tags”, and have page 1, page 2 navigation below.

    The only difference is the post are not sort according to date. It should be sorted by alphabet for easy navigation.

    BTW please do not ask me to modify any of my wordpress core files. I don’t know how to re-create this “miracle” after an update.

    Did I mention anything about modifying any WP core files???
    No, I didn’t.

    Did you read the resources I linked to?
    I will write here the short version: DO NOT USE PAGES. Period.

    First make working category templates. Not Pages but category template files (e.g. category-1.php, category-3.php etc. – the sidebar thing can be applied to them, too)
    After that we will take care of the alphabetical order.

    Thread Starter rufaswan

    (@rufaswan)

    Hey moshu, don’t be so angry.

    And yes, I did went through the link, but forgive me for I am not a programmer, I don’t really understand how to do it.

    Since you mention about some php files, I done a google search, I assumed that those files are located within the template directory.

    Then, I edit the file with my limited understanding of that page. Here is the file:

    <?php

    /*

    Template Name: Archieve
    */

    ?>

    <?php get_header();?>

    <div id=”main”>

    <div id=”content”>

    <div class=”post”>

    <h2 class=”title”>” rel=”bookmark”><?php the_title(); ?></h2>

    <div class=”entry”>

      <?php query_posts(‘cat=4&showposts=10’.get_option(‘posts_per_page’)); ?>
      <?php the_excerpt(); ?>

    </div>

    </div>

    </div>

    <?php get_sidebar();?>

    <?php get_footer();?>

    That’s a Page template. I don’t know how to do it with Pages.

    I told you how it should be done the easy way. You don’t need to google for anything: everything is written down at the Codex turorials.

    If you want to do it in another way – don’t ask me.
    (I am not angry – yet…)

    Thread Starter rufaswan

    (@rufaswan)

    At least I got ONE thing right.

    But I have problem to understand the tutorial. I don’t know where and how to put it those code.

    Maybe there is some copy-and-paste solutions out there, somewhere…

    You do NOT use that code of yours because it is not good.

    You save your index.php or archive.php file (NOT the archives.php Page template!!!) as category-xx.php file(s). Edit them for the inclusion of your custom sidebar.
    What is soooo complicated in this?

    Then use a plugin like CQS to set the number of posts shown and the order.
    Done.

    Thread Starter rufaswan

    (@rufaswan)

    Why don’t you tell me about this plugin from the beginning, this plugin rocks!!

    It completely solved my problem. All thanks to you!

    So now, problem solved, case closed!

    See ya!

    Why don’t you tell me about this plugin from the beginning,

    Because you were obsessed with Pages… and the plugin is not for Pages. That’s why. I told you in my second post: take care of the properly functioning category templates and we will take care later of the alphabetical order. But when users have preconceptions – they are not receptive to common sense solutions.

    Thread Starter rufaswan

    (@rufaswan)

    Hi moshu, I’m still around. Never though of that do you?

    Well, thanks to you, I can somehow solve the problem, at least with some tweaking, for now.

    And BTW, I hope you won’t mind if I want to dig to the bottom of this. I wish to understand the “solution” that you intended for me. Nothing special, just for the sack of curiosity.

    I noticed this part, but I cannot find any matching place to put:
    http://codex.wordpress.org/Category_Templates#What_categories_do_you_show_to_the_visitors.3F

    And it say something about query_post, place before the loop, that I have no clue what to do.

    If you want the achieve.php, here it is.

    [code removed]

    1. I never want code here – nobody can read it.
    (use a pastebin service, like http://wordpress.pastebin.ca if you feel the urge to post a long code)
    2. There is no achieve.php template file.
    3. That’s a completely stupid and wrong part on that Codex page: it is about archive.php and NOT category templates. Should be removed. Sorry, that’s not your fault!
    4. Don’t post code and don’t get technical. Ask in plain, simple English WHAT do you want to do. WHAT is the result you want? We will tell you the HOW. It saves a lot of time and anger…

    Thread Starter rufaswan

    (@rufaswan)

    Sorry for that, I thought you need to see the code, that’s why I post it.

    So… how?

    So, “how” what?
    Don’t show me code. I am code illiterate. Describe me what is the desired end result what you want.

    Thread Starter rufaswan

    (@rufaswan)

    You said

    “3. That’s a completely stupid and wrong part on that Codex page: it is about archive.php and NOT category templates. Should be removed. Sorry, that’s not your fault!”

    but you also said

    “You save your index.php or archive.php file (NOT the archives.php Page template!!!) as category-xx.php file(s). Edit them for the inclusion of your custom sidebar.”

    What is the meaning of these? Aren’t they the same? And what should I do?

    And most important of all, what result did your “solution” was intended to give? Same thing as your plugin?

    Listen! Forget EVERYTHING you tried to do till now, before you started to ask. Everything.

    Close your theme’s files. All of them.

    Open an unaltered (virgin) copy of the default theme.
    Look at the file names.
    There is
    archive.php
    and there is
    archives.php (with plural S at the end)

    Those are two very different things – and you are mixing them all the time. I am open to arguments if you know what are you talking about. If you don’t, just follow the instructions to the letter.

    archive.php (no S) is a template file used to list/display the monthly and category archives: i.e. listing posts for one month or for one category. That is the file you were supposed to work from!!!

    archives.php is a Page template – close it and forget it. We will not work with it. Period.
    We will not work with any of your Page templates either. Close them. Throw them away… whatever.

    When you understood this, come back and we will take it from there.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Specific Category Page Template’ is closed to new replies.