WordPress.org

Ready to get started?Download WordPress

Forums

Customizing Single.php (8 posts)

  1. FireFox
    Member
    Posted 8 years ago #

    hi,

    how do you customize a single.php posts/pages for a particular link, such as a category title?

    for example, if i have dog, cat, and rabbit as my 3 categories, and the viewer clicks on the "dog" category link on my sidebar, the single.php for the "dog" category shows up.

    i would like for that particular dog page (single.php) to have its' own static information (such as a picture of a dog and some specific headings and words on top of that single.php only)

    this would be true for the 2 other category (cat and rabbit).

    is this customization possible?

    thanks, much appreciate any info.

  2. Kafkaesqui

    Posted 8 years ago #

  3. FireFox
    Member
    Posted 8 years ago #

    i forgot to mention..

    this is for the dynamic single.php, not for the static pages that can be produced in wordpress.

  4. FireFox
    Member
    Posted 8 years ago #

    thank you very much Kaf.

    i'm little confused over the instructions.

    for my 3 categories - dogs, cats, and rabbits, do i create 3 separate customized single.php for them and renamed them:

    dogs-1.php
    cats-2.php
    rabbits-3.php

    for each of those, i put their own pictures and whatever else i like to say for each animal on the top - before the posts.

    how do i call them from the category links?

    thanks

  5. Kafkaesqui

    Posted 8 years ago #

    The default format for the template names used with the plugin would be:

    single-cat-1.php
    single-cat-2.php
    single-cat-3.php

    The numbers represent the category IDs. And no need to provide any links to them. If the plugin is active and the template exists for the category, it's (automatically) assigned to any post within that category, much as single.php is for all single post pages (well, unless you're using my plugin :) ).

  6. FireFox
    Member
    Posted 8 years ago #

    do i need to place the call function within header.php (or whereever the category links are located):

    szub_post_template_by_cat()

    what happen if i use the full urls to link to my categories (for example:

    http://www.thefirefox.com/category/dogs/
    http://www.thefirefox.com/category/cats/
    http://www.thefirefox.com/category/rabbits/

    i have those in my header.php to call the particular category.

    do i still need to use your call function?
    thanks again

  7. Kafkaesqui

    Posted 8 years ago #

    You're making this harder than you need to. First, something like:

    http://www.thefirefox.com/category/dogs/

    that is the individual category, can be uniquely "templated" through the functionality WordPress already offers:

    http://codex.wordpress.org/Category_Templates

    Now, to 'template' posts within that category, you only need to 1. install and activate my plugin, then 2. add a template for the category (i.e. single-cat-1.php) to your theme's directory. The plugin takes care of the rest.

    In other words, you do not need to call any function from the plugin.

  8. FireFox
    Member
    Posted 8 years ago #

    ok i'll run some tests

    thanks for you instructions

Topic Closed

This topic has been closed to new replies.

About this Topic