• Hi, I just installed WP for the first time today, I like it quite a bit, no fuss, very straight forward, however, I have not found a place where I can see the list of tags and variabled used. I can see that it has more options then what the original template includes.
    My main question is about categories, obviously the links can be split into different categories, now how do I display that on my journal..it’s a nice feature if its possible.
    But the best help would be a list of all the variable that can be used, maybe I missed it..am not sure..but would appreciate some one to guide me there..
    ??
    lou

Viewing 14 replies - 1 through 14 (of 14 total)
  • I( would like to see this as well

    I presume you are talking about link categories rather than post categories.
    If so you can simply call wp_get_links(category_number) or wp_get_linksbyname(category_name) in your template to list just the links in one category. The output of these functions will use the various settings defined in the Manage Links -> Manage Link Categories section.
    There is also get_links_list() which will list all links organised by category.
    The file wp-links/links.php has some documentation in the comments above each function.
    Mike

    But this is a list of the links from within LINK CATEGORIES. What about a list of posts within a category? There is a lot of confusion with this.

    Moderator James Huff

    (@macmanx)

    Is this what you’re looking for? https://codex.www.ads-software.com/Template_Tags

    You have to be more specific. I’ve been through the most logical of these (discovering some goodies along the way) but I still can’t find something to list the posts in a category from within a post.

    I’ve tried wp_get_links, get_links, get_linksbyname, etc. They don’t work from within the post.

    There is a plugin called wp-lists that will allow php code to print a list from its database of links, but I don’t want to go through and enter in every post from a category into another list just to be able to list the posts from within a category in a post.

    If you use the plugins runphp and customisable post listings you might be able to cook up what you are looking for.

    Actually, you might be onto something. I remember customizable post listings have tons of features…I’ll double check it.

    Thanks.

    Lorelle, all the “Links Manager Tags”, as the Template Tags Codex page calls them, only display Links that you’ve explicitly defined in the Links Administration Panel. They don’t have access to Posts or Categories.

    Are you still trying to make a list of all Post Titles (or slugs, for that matter) or a list of all Post Titles of Posts within a specified Category? If so (and assuming it’s for 1.5), please post in the Beta Discussion Forum to grab my attention. If not, nevermind :)

    I’m trying to make a list inside of a post of the links to posts within a specific category. Typically a sub-category, but that part doesn’t matter. I like having a list of articles within a series in a box inside the article, pulled out of the sidebar, to draw attention to it, since they are “connected”.

    I’m using both versions, but this is about 1.5 specifically. Is there a difference between how the different versions would interpret the php list request within a post? I thought it would be the same no matter which verson. If there is a diff, I’ll switch this to 1.5 beta.

    1.5: I only know how to do this in 1.5 (not because it can’t be done in 1.2, but because I really only know anything about 1.5).

    I’m glad you specified this was within a post. That makes things different (and harder). Without gettting into custom SQL queries, the only way I know of to get a list of Posts is to use the Loop. Since you need a list of Posts, within a Post, that means you need a Loop inside a Loop. This is doable, but gets quite complicated. More so if these posts of yours are filed under multiple categories (instead of just one category each).

    Fortunately there is a plugin that will generate the custom SQL for you. Customizable Post Listings.

    Do you want this to happen with ALL posts? If not, it’s a bit harder yet – you’ll need custom fields (aka meta data), or some really sneaky category magic. Supposing you want this to happen to ALL posts, though, and supposing you’re using the default (as in Kubrick based) theme, edit index.php:

    Under the </div> closing the class="post" div (just above an endwhile, insert the following.

    <?php
    $my_cat_ids = "";
    foreach ( $category_cache[$post->ID] as $my_cats) :
    $my_cat_ids .= $my_cats->category_id . " ";
    endforeach;
    ?>

    <ul class="posts-in-cats">
    <?php c2c_get_recent_posts ("-1", "<li>%post_URL%</li>", $my_cat_ids)?>
    </ul>

    The first section generates a “space separated list” of the category IDs for the current post: “1 10 34”. This is the part I’m a little sketchy about; I don’t know if category_cache is the best way to go about this.

    The second section generates the list of links to posts in those categories (-1 for “do not limit the length of the list”).

    EDIT: Ah – in rereading your post, it sounds like you need to be able to specify the category from which to generate a list of posts. The above grabs the categories from the current post. The best way to do this is with custom fields. I don’t have time to write up anything at the moment.

    …Perhaps there is a plugin for this?

    https://www.scriptygoddess.com/archives/2004/07/24/nextprevious-posts-in-same-category/

    https://www.chait.net/index.php?p=87

    I have no idea if these can be made to do what you want. I have not even looked at them.

    If they can’t. This will.
    1.5

    You still need the Customizable Post Listings plugin mentioned above. However, instead of the above code, you only need:

    <?php if ( get_post_meta($post->ID, 'cat_in_post', true) ) { ?>
    <ul class="posts-in-cats">
    <?php c2c_get_recent_posts ('-1', "<li>%post_URL%</li>", get_post_meta($post->ID, 'cat_in_post', true))?>
    </ul>
    <?php } ?>

    BUT, for each post on which you want the list of posts within a category to appear, you need to give it a “Custom Field” (only available after clicking the “Advanced Editing” button when writing a post). The Custom field must have:
    Key = cat_in_post
    and
    Value = the ID of the category. You can do mulitple categories by separating each ID with a space: “2 5 16”.

    I’m looking at the documentation for wp-exec and will give the other one I try, since I already have customizable post listings plugin installed (love it!!!) but hadn’t figured out how to get the categories into the posts. Great for the sidebar but not in the posts.

    WP-exec might do it. I’m going to give it a try tomorrow after I’ve been through the papers. This plugin looks like it has the potential to be really slicko by allowing a bunch of php stuff to happen within a post. Worth serious consideration.

    It took a while but I looked through wp-exec and it doesn’t what I need. I need to post a list of posts within a category INSIDE of a post.

    As for the IF/Else code above, I’m not sure where to put it since I don’t want this ability on every post, but just in specific categories where I need a kind of table of contents within the post to help people move through the article series.

    Here’s an example. I have a series of articles on the basics of nature photography. They are in progression, but I don’t want to put them all into one post (they won’t fit anyway – WP cuts them off) with NEXTPAGE, but posted as a sequential series. I can’t figure out how to guide people from post one in the series to post two, and post three. I have a lot of series, so this is important. And when they are finished with the series, I want the NEXT post to be within the same category so they can continue on with similar information. Instead, they go from basic photography techniques to how to stay in touch while traveling – connected but ~~not really~~.

    If I could find a NEXT PREVIOUS tag that works by continuing next and previous within the same category, I might not be so stressed about this. But without “same category” options working, my next and previous are all over the map and I need people to follow articles which are in a series IN the series.

    How have others solved this problem?

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Categories’ is closed to new replies.