• Resolved amdh

    (@amdh)


    Hi

    For each post on my blog, I need two pages. One page for that post which shows post title and post excerpt with a button to second page. Second page for the same post but it shows the title and post content. How can I do this?

    Thanks

Viewing 10 replies - 1 through 10 (of 10 total)
  • Howdy_McGee

    (@howdy_mcgee)

    Most themes support this. You assign a blog by going to Settings -> Reading. Here you can decide if you want the homepage to show your latest posts or if you want a static page as your homepage, then you can assign another page as the “posts” page.

    Here’s an explanation by Dreamhost on the differences between pages and posts along with how to setup a blog. There’s another article by WPBeginner which may also help clear things up.

    Thread Starter amdh

    (@amdh)

    I know that. I need different pages for a single post. Imagine my blog has a category page which shows 10 posts title only. Then user selects a post. After category page, is a page with post title and excerpt only. I need a 3rd page which shows title and full content for the same post.

    Howdy_McGee

    (@howdy_mcgee)

    You could create a page template to display a list of your categories via get_categories().

    – The first page would be a Page Template listing all categories
    – The second page would be the category page displaying the titles and excerpts
    – The third page would be the single post page.

    – – – – – – – – – –

    A bit more complicated approach would be creating an endpoint on your categories. You could do this by adding an endpoint to the taxonomy/category.

    – The first page would be the category landing showing the titles
    – The second page would be the endpoint displaying the titles and excerpts
    – The third page would be the single post page.

    – – – – – – – – – –

    Either way it would require some development or custom work. You may be able to achieve this with a page builder, shortcode, or something similar that allows you to easily add a list of categories to a page.

    Thread Starter amdh

    (@amdh)

    You are getting closer. But the second page should display only one (just one) post title and excerpt. not titles and excerpts of a category.

    • This reply was modified 6 years ago by amdh.
    Howdy_McGee

    (@howdy_mcgee)

    If there’s many posts in a category how would you decide which title and excerpt displays? Either way, the methods above are how you could achieve something like this. Along with the pre_get_posts hook.

    Thread Starter amdh

    (@amdh)

    Please read my replies exactly. Users select a post from category page. Selected post’s title and excerpt will be shown on second page. And selected post’s title and full content will be on 3rd page.

    There’s no problem with category page that I use pre_get_posts().

    Howdy_McGee

    (@howdy_mcgee)

    Ok, WordPress doesn’t support this by default. You would need to develop an endpoint to handle your 2nd page using the described option above.

    Thread Starter amdh

    (@amdh)

    I’m theme developer. Now how can I develop the 2nd page.

    Howdy_McGee

    (@howdy_mcgee)

    Here’s a good article on creating a rewrite endpoint. The permalink constant would be EP_CATEGORY. You would also need to use add_rewrite_rule() to write any additional query vars to the permalink. You may be able to use name instead of creating your own custom query vars.

    Thread Starter amdh

    (@amdh)

    Thanks.
    add_rewrite_endpoint resolved my problem.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Diffrent views: one page for excerpt, another for content’ is closed to new replies.