• Resolved antishape

    (@antishape)


    Is it possible to include a category’s posts (even if the cat doesn’t show up because I excluded it, but status is published) in a page? I’d like to add the posts of specific cat into a page to be display (headlines only) but doesn’t know how to do it. Tried different html sitemaps but they didn’t do well and the same goes to different php execute plugins to include get_post code from the wp codex. Any other way? Maybe conditional tags? If so, where do I need to include the conditional tags and how do I solve my problem mentioned above.

Viewing 15 replies - 1 through 15 (of 24 total)
  • If it is a page then a page template would work, or a copy of index.php with a query, which theme are you using?

    Example with images:
    WordPress Twenty Eleven One Category Page, where the page slug = category slug, like category News (slug=news) Page News (slug=news), page content can be written with the posts below.

    page-category.php
    https://pastebin.com/h59nXctx

    The content or loop image removed(content-onecat.php)
    https://pastebin.com/cwAJxhTc

    HTH

    David

    Thread Starter antishape

    (@antishape)

    It’s the Wire Magazine theme. Don’t how to do both of the suggestions.

    Is it a free one, if so add a link!

    Thread Starter antishape

    (@antishape)

    Thread Starter antishape

    (@antishape)

    Do I need backticks or without them? Both versions doesn’t function anyway.

    Used this:
    [catlist category=2419 orderby=post_title order=ASC post_type=posts post_status=published]

    Put this code while html mode or in visual?

    Try this template page, if you have ftp, copy the raw code and save it in a file page-onecat.php.
    https://pastebin.com/UKzpZ6BX

    Upload it to the themes folder via ftp.

    if the category was sports, create a new page and make the page slug the same as the category slug, add the page to the menu, then apply the template to the page and you have a page with titles and excerpts.

    It was created from the index.php and page.php of the Wire Magazine theme, and has been tested.

    HTH

    David

    Thread Starter antishape

    (@antishape)

    Thanks, looks good. But how do I add cat-id and how to display it in a browser? Couldn’t find any sections where I can add a id or cat name or a slug. Nor do I know how to embed it in my page which already exists and should display this.
    Both, cat and page (the one with posts of the specific cat) are named people. That’s also the slug of both, cat and page.

    You can start with an empty page if you do not want a leader text block.

    Admin > Pages > Pages find the page ‘People’ and quick edit, there is a dropdown option “Page Template” select One Category and publish.

    The page has two sections the first is the page content so you can add static text which is optional.

    The second section will display the Title and Excerpt for any posts that are in a category with the same slug page slug = people and category slug = people

    Let us know if you find it ok.

    HTH

    David

    Thread Starter antishape

    (@antishape)

    Done. But nothing appears.

    Both cat name and page have the same name (People) and slug (people) and the cat contains one post to display but nothing happens.
    https://www.newssquared.de/people/

    Any idea?

    Admin > Pages > Pages find the page ‘People’ and quick edit, there is a dropdown option “Page Template” select the template ‘One Category’ and publish.

    Thread Starter antishape

    (@antishape)

    That’s what I did.

    That is strange, I have tested it here and it works fine.

    https://digitalraindrops.net/images/wire-magazine.png

    have you got a category with many posts, just change the page slug to match and test again?

    David

    Thread Starter antishape

    (@antishape)

    Checked it again with a category including many posts. It’s fine.

    Don’t know what’s up with the category. Maybe it’s something with the cat title and page title, should I change? Guess it depends only on the slugs so it won’t matter?

    Thread Starter antishape

    (@antishape)

    And, by the way does it matter if the both page and category aren’t visible for visitors but still published? They’re just excluded from the menu.

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘how to include posts of specific cat in a page?’ is closed to new replies.