WordPress.org

Forums

Title only in category list (11 posts)

  1. shawno
    Member
    Posted 11 years ago #

    Requesting code for displaying titles only when users click on an archive link. If you've got alot of titles with alot of text, that would make it easier for users to find what they are looking for.

  2. Nick Momrik
    Member
    Posted 11 years ago #

    I think this may be what you are looking for...
    http://wiki.wordpress.org/index.php/MtDewVirus%20Archives

  3. shawno
    Member
    Posted 11 years ago #

    Well, I got the code to work but it doesn't seem to do anything but display the URL differently (and display only one day's worth of posts in the archive due to the what_to_ show: 'days' setting). I looked at the archive structure of the site that inspired it and that is the sort of structure I wanted (titles only), but my archive is a list of posts with the content php'd too. What I'd like is to display the archive without the content.

  4. Nick Momrik
    Member
    Posted 11 years ago #

    If you implement it correctly, the archives will only show the titles. Have a look at it on my site. If you are on a day archive or single post archive, it will display the entire post, but other than that, it should give you a listing of the post titles. It can be changed easily through the mod_rewrite rules to only show the full post when on a single post archive. If this is what you like, post back and I can help with the new rules.

  5. shawno
    Member
    Posted 11 years ago #

    I think I've followed the instructions to the letter. Anyway, I have another idea on how it might work. I've managed to create a 'arch.php' file that displays the archive the way I wan't it--I just comment out the 'the_content()' part. Now, if I can get the archive links to point to arch.php instead of index.php, it would work. I'm wondering if these are the lines to modify (under 'get_archives' function) and what to do to them.
    // archive link url
    $archive_link_m = $siteurl.'/'.$blogfilename.$querystring_start.'m'.$querystring_equal; # monthly archive;
    $archive_link_w = $siteurl.'/'.$blogfilename.$querystring_start.'w'.$querystring_equal; # weekly archive;
    $archive_link_p = $siteurl.'/'.$blogfilename.$querystring_start.'p'.$querystring_equal; # post-by-post archive;

  6. Nick Momrik
    Member
    Posted 11 years ago #

    You shouldn't have "the_content()" in arch.php at all if you followed the directions.
    The mod rewrite rules are what point the archive links to arch.php instead of index.php.

  7. shawno
    Member
    Posted 11 years ago #

    Right. I figured-out where I went wrong. In the instructions it says to insert the code into the div='content' area. I completely ignored everything from div class='post' on. My other idea was to comment out 'the_content()' in the copy of the index file (the only change). That displayed the archive just the way I wanted it, and seems like a pretty easy fix. Maybe the rewrite rules will work for this method too. I'll try it.

  8. Nick Momrik
    Member
    Posted 11 years ago #

    If you simply want to keep the same type of layout, but just not show the content, that is actually very easy. My guess is that you don't want to show the link to comments either. You could use this code:
    <?php if($single) { ?>
    <div class="storycontent">
    <?php the_content(); ?>
    </div>
    <div class="feedback">
    <?php link_pages('
    Pages: ', '
    ', 'number'); ?>
    <?php comments_popup_link('Comments (0)', 'Comments (1)', 'Comments (%)'); ?>
    </div>
    <?php } ?>

  9. shawno
    Member
    Posted 11 years ago #

    Yes it works. Let me list what I did for future reference for anyone who wants to try it. It's very simple, and you can see it in action at my site.
    1. Change permalinks as suggested in Mt.DewVirus' guide and copy corresponding rewrite rules to .htaccess file.
    2. No my-hacks.php file is required.
    3. Open index.php and comment-out 'the_content()' like so:
    <div class="storycontent">
    <?php //the_content(); ?>
    4. Save the file as 'arch.php'.
    5. Set what_to_show as 'posts'
    Done.

  10. shawno
    Member
    Posted 11 years ago #

    Ok, but that shows only the title for the index page as well. I wan't to show the content on that page, but not the archive.

  11. Nick Momrik
    Member
    Posted 11 years ago #

    Whoops...sorry, $single must not get set when simply calling the index.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.