Forums

Making archives appear & removing sidebar (9 posts)

  1. Jinsan
    Member
    Posted 4 years ago #

    I tried the search, but nothing too relevant that I could perhaps use. Still playing with the kubrick theme.

    I'm trying to create a page solely for archives, but don't know how to do this. So, I installed the weighted archives plugin and another one I think. Neither seems to be actually doing anything.

    How can I make the archives appear on a seperate page that can be linked to? I would like them categoriesd by, er, category and also year, below which month as well as the weight categories.

    Thanks in advance for link, tips and suggestions

    Here's the link to the site: http://sekhu.net/wp/

  2. mdawaffe
    Member
    Posted 4 years ago #

    The default Kubrick for 1.5 has a convenient way to do this through the Template feature of WP 1.5 "Pages".

    1. Write a new "Page" through the Admin Panels. Call it "Archival"
    2. Write "My wife is no longer a horse" in the main textbox. It won't be shown (unless you modify archives.php, see below)
    3. Select "Archives" from the "Page Template" dropdown (below the main text box).
    4. Save the page
    5. View your site. You should now see a link "Archival" under a "Pages" heading. Click it and you will be taken to a page that lists your categories and monthly archives

    All this works because of a file called archives.php (found in the same directory as all the other default Kubrick files: wp-content/themes/default/). If you edit that file, you'll see the following at the very top.

    <?php
    /*
    Template Name: Archives
    */
    ?>

    WordPress 1.5 "Pages" can be set to look at any Template, not just the normal index.php/page.php. The text at the top of archives.php tells WordPress that that file is to be used whenever a page is set to call the "Archives" Template.

    Notice also that in the archives.php there is very little code. All it does is list monthly archives:
    <?php wp_get_archives('type=monthly'); ?>
    and categories:
    <?php wp_list_cats(); ?>
    That's all it does; it never displays the content ("My wife is no longer a horse") of page. If you want the Archives Template (archives.php) to display the page's actual content, you'll need to edit the file:

    Insert directly below
    <div id="content" class="widecolumn">
    the following chunk of code:

    <?php if (have_posts()) : while (have_posts()) : the_post();?>
    <div class="post">
    <h2 id="post-<?php the_ID(); ?>"><?php the_title();?></h2>
    <div class="entrytext">
    <?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>

    <?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?>

    </div>
    </div>
    <?php endwhile; endif; ?>
    <?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>

    (I stole this from the default page.php)

    The first if statement starts The Loop. The Template Tags in the <h2> do precisely what they say. the_content template tag is what actually spits out the text of the page ("My wife..."); everything else was really just getting us to the point where that tag could be used.

    So all that in in response to your question. Note, though that you can create any number of templates and use them to customize any individual "Page". You just need to write in some similar code at the very top of the new template file, making sure to specify a unique "Template Name". (By "similar code", I mean the first bit - the five line long one. You only need to include that second chunk of code if you want the content of the page displayed).

  3. mdawaffe
    Member
    Posted 4 years ago #

    A quick note a bout "Pages" and Templates. WordPress will use whatever Template you specify from the "Page Template" dropdown. If you specify nothing, WordPress will use the default page template: page.php. If page.php doesn't exist (it's an optional file, see this for more information about what Template files WordPress looks for), WordPress will use your theme's index.php.

  4. Jinsan
    Member
    Posted 4 years ago #

    Thanks for the response but that's left me even more confused. I ideally I want the weighted categories plugin in to work. I've followed the instructions as best I can but I get the following error message:

    Warning: Invalid argument supplied for foreach() in /home/jinsan/public_html/wp/wp-includes/template-functions-category.php on line 324

    The plugin is here:

    http://www.hitormiss.org/projects/weighted-categories

    Hope someone can help.

  5. mdawaffe
    Member
    Posted 4 years ago #

    It's probably because you are trying to exclude categories which don't exist.

    The code snippet provided on the Weighted Categories site:

    <?
    $minfont = 10;
    $maxfont = 40;
    $fontunit = "pt";
    $category_ids_to_exclude = "1,25";
    weighted_categories($minfont, $maxfont, $fontunit, $category_ids_to_exclude);
    ?>

    Change the $category_ids_to_exclude line to:

    $category_ids_to_exclude = "";

    This will show all of your categories.

  6. Jinsan
    Member
    Posted 4 years ago #

    ah i see....ok I'll give it a shot - thanks:)

  7. Jinsan
    Member
    Posted 4 years ago #

    Well I got it to work....sort of :p

    http://sekhu.net/wp/index.php?page_id=6

    As you will see the box in which the text is supposed to be...it isn't in there and the box isn't the right size, I want to it stretch across the white space, but have some space around it. I think most of all I'm trying to figure out why the font is GIBLOODYNORMOUS!

    Any hints? I'm playing the CSS.

    Please help :)

    I fixed the font size, need to fix the box now :( It's sort of fun though :)

    Edit 2: Sorted the centering, but now I can't figure out how to move the box upwards, there's too much space for me between the last word in the categories above the box and the box itself. I want to remove some of that white space.

    Thank you!

  8. mdawaffe
    Member
    Posted 4 years ago #

    Don't know exactly what's causing it, but

    #categories {
    border: 3px solid #ccc;
    background-color: #eee;
    padding: 4px;
    width: 500px;
    margin-left: 73px;
    margin-top: -5em;
    }

    fixes it (adjust margin-top to your preference).

  9. dawg
    Member
    Posted 4 years ago #

    One of the most interesting and informative posts I have read in a while

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.