Support » Themes and Templates » Help with a Custom Template

  • I need some help modifying the “A Page of Posts” template from the WordPress Codex:

    I want to make a template like this, but the one in the example uses the category name as its variable. I want to change that from category name to category ID, or category slug.

    The reason is that I am using a multilingual plugin, so that category name changes from language to language, and thus this template breaks when using translated names.

    Can someone teach me how to modify this template to look for category ID or slug instead of name? Thanks so much!

Viewing 6 replies - 1 through 6 (of 6 total)
  • *bump*
    Can nobody help?

    It’s probably much easier to just make a category template page rather than do that.

    Thanks, I’ll try that.

    and it apparently didn’t let me post my link….

    Thank you.

    I’m still having a bit of trouble doing what I want to do.
    Here’s what I’m aiming for:

    I want to make separate menu items on the main menu that will only display posts from different categories. For example, “Chinese Blog” and “Portuguese Blog.” If you click on the Chinese Blog, it will show you only those posts in that category; and similarly if you click on Portuguese Blog it will only show you those posts in that category.

    My thought was to use Pages using that “A Page of Posts” template above, but as I said I couldn’t figure out how to change the php code from reading the Category Name field to the Category ID field (my category names changes in different languages due to the multilingual plugin I am using, so that field is not useful for me).

    Using category templates would work just fine as well, but how can I turn them into Pages so they appear on the site’s Menu?

    Alright well, I found one way to workaround this since nobody can help me with the template. In case anyone finds this post later on and wonders how I did it, all I had to do was put the url for the category I wanted as the page title. In other words, for the page title, I wrote

    < a href=”index.php?cat=4″>Portuguese Blog< /a>

    (without the spaces)

    and that did the trick.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Help with a Custom Template’ is closed to new replies.