• Resolved resting

    (@resting)


    Is it possible to publish my post to different pages based on the categories?

    Say personal stuffs goes to personal page, information stuff goes to information page?

Viewing 4 replies - 1 through 4 (of 4 total)
  • You don’t actually publish to pages. WordPress native archive ability can handle that.

    Don’t be confused by what an archive is–it is just a generated display of your posts at that moment. You don’t do anything to create the archive, that’s an automatic thing WordPress does for you. Usually, archives are date, category, tag, or author, based.

    Access to archives is typically presented via links in a sidebar under an Archive (date based), Category, or Tag Cloud, headings. Widgets, or Template Tags such as wp_get_archives(), wp_list_categories(), wp_tag_cloud(), and wp_list_authors(), are the constructs used to present links to users to visit your various archives. The process of placing code in your Theme’s Templates is explained in Stepping Into Templates and Stepping Into Template Tags.

    Once a user clicks on a Category link in the sidebar, the display of those posts can be controlled by a Category Template. Other Templates, such as Author Templates, and Tag Templates, are available if you set them up. These Templates can be coded via Template Tags such as the_title(), the_content(), or the_excerpt(), to display just a post title, the full content of the post, or just an excerpt of the post.

    Also, it is important to understand the Template Hierarchy, as that is how WordPress determines what Template to use to render the posts for reading by your readers.

    If a user visits a Category archive, then clicks on a given post title in that Category archive, the display of that single post is again presented by another Template, and again, the Template Hierarchy determines what Template displays that single post. Finally, that single post Template can be coded to display just the title, the full post content, or an excerpt.

    If you are referring to having custom layouts for each “type” of post (ie. category of post) then you CAN create custom category.php template files… just duplicate the category.php file and append the category number like so: category-3.php using (of course) the appropriate category number which you can easily get by hovering over the category in question in your admin in the category list.

    Within the heirarchy, WordPress will default to using the custom category-x.php file if it is available when displaying a number of posts for that category, for example, if you click the link for the category created from using wp_list_categories();

    Understanding what MichaelH suggests above is pretty required to understand how the whole WordPress application manages data and files.

    Good luck with it!

    Thread Starter resting

    (@resting)

    oh from what i see, i mean to create categories that act like pages.

    guess i try out the custom category template thingy. thanks for the advice.

    You are welcome. I remember how confusing it was for me when I first started using WordPress and trying to decide which type of post to build a site on. I do a lot of sites that use WordPress in for a Content Management System (CMS) so use the page.php and its easy to create and understand page templates – just selecting the template in the Attributes Template menu from the Pages Write/Edit screen in the admin.

    I generally use the page.php file and Pages for most sites unless they want a News or Blog function — for content that isn’t replaced when edited but appended… with a need for chronological sorting. WordPress defaults to deciding which file to use to display content based on the post type – category or page, but honestly, they are all posts. You can quite easily use a custom query to display posts from a category in the page.php file. I do it all the time. In fact, you can have multiple loops to show posts from one or more categories AFTER displaying the Page’s content in the original loop.

    ASIDE/OPINION:
    I honestly wish that WordPress would simply allow the app to have template and “parent-child” global options for Categories.. to allow us to use the same sort of method for selecting a template from a menu for all sub-categories in a category, right from the category’s admin page…. and be able to override that on a per category (child) basis in the child category options.

    I’ve posted that IDEA: https://www.ads-software.com/extend/ideas/topic.php?id=3243#post-13772

    if anyone wants to vote for it. It also poses the concept of having a SORT option applied per Category (on a global level unless overridden by a per (child) category option.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How do I publish my posts to different pages based on categories??’ is closed to new replies.