Support » Developing with WordPress » Show specific pages by clicking on a link

  • Resolved giannit

    (@giannit)


    Hi, I’m creating my site locally.
    Main content of the site are homeworks. For each exercise I create a page (not a post) so there will be soon a lot of pages.
    I have already added a search bar to look for a specific exercise, but I would like also to have a page showing all the topics and subtopics in such a way that by clicking on a subtopic, a page is opened showing all the excerpts of the exercises related to that specific subtopic.
    Since pages don’t have categories or tags, how is it possibile to show a specific list of pages by clicking on a link?

Viewing 5 replies - 1 through 5 (of 5 total)
  • JNashHawkins

    (@jnashhawkins)

    Nothing says you need to use pages to contain ‘pages’…

    Feel free to use posts if you want then you can make use of the categories and the tags as you wish to segment those posts to category pages.

    An upside of using posts is they wind up in the RSS feeds to help segment the newer posts for those visitors who make use of Atom and RSS. Some of the search engines like the RSS feeds, too.

    giannit

    (@giannit)

    Thank you @jnashhawkins, so what are more suitable categories or tags in my case (click on a link which opens a page showing the excerpts of all the posts with a specific category / tag) ?
    And how to get such a link?
    Thank you

    • This reply was modified 1 month ago by  giannit.
    • This reply was modified 1 month ago by  giannit.
    • This reply was modified 1 month ago by  giannit.
    giannit

    (@giannit)

    @jnashhawkins I found out that categories are more suitable.
    I just have to understand how to write in a page the link to a specific category.
    On codex I’m reading about the function get_category_link, but I don’t understand where I have to write this code:

    <?php
        // Get the ID of a given category
        $category_id = get_cat_ID( 'Category Name' );
    
        // Get the URL of this category
        $category_link = get_category_link( $category_id );
    ?>
    
    <!-- Print a link to this category -->
    <a href="<?php echo esc_url( $category_link ); ?>" title="Category Name">Category Name</a>
    JNashHawkins

    (@jnashhawkins)

    You’re trying way too hard.

    Look at this category page from one of my own websites..

    http://trainstrainstrains.com/category/news/

    Look down the right hand ‘sidebar’ of that site. There are widgets there to display my categories. I can place a tag cloud there if I want. I just did. Then I moused over it and copied that link here.

    http://trainstrainstrains.com/tag/freight-cars/

    I can snag the url from a tag or category and reference it anywhere (like I did here), I can stuff that URL into my menu or my next post on the site.

    I can post it to social media! I can mention it in my next email.

    And to answer your question about suitability? Use both!

    Categories to organize things. Tags to cross promote by a subject outside of the title and category… but tags can also mention those, too!

    Up in the menu you’ll find movies and under that there are ‘movies by categories’.

    This site illustrates what I’m talking about.

    giannit

    (@giannit)

    Oh it was easier than expected! Thank you so much @jnashhawkins

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.