• 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)
  • 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.

    Thread Starter 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 5 years, 9 months ago by giannit.
    • This reply was modified 5 years, 9 months ago by giannit.
    • This reply was modified 5 years, 9 months ago by giannit.
    Thread Starter 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>

    You’re trying way too hard.

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

    https://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.

    https://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.

    Thread Starter giannit

    (@giannit)

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Show specific pages by clicking on a link’ is closed to new replies.