1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

I want to display my "categories pages" under "categories" in footer.

Discussion in 'WordPress' started by Rashida H., Mar 15, 2019.

  1. #1
    Hi There,

    Hope, you all are doing well.
    SEMrush
    WEBSITE: https://www.directsupplyservices.com

    I want to display my 5 categories pages in the footer under "Categories". How can I do that?
    Kindly advise.
    For your reference:
    https://screenshots.firefox.com/fG5S8onH95Ne652m/www.directsupplyservices.com

    Thanks & Regards,
    Rashida H.
     
    Rashida H., Mar 15, 2019 IP
    SEMrush
  2. snaroliya

    snaroliya Member

    Messages:
    48
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    45
    #2
    This code gives you posts from a category, notice category ids in the arrugments.

    
    $getposts = get_posts( array( 'category__in' => '1, 2', 'numberposts' => 5 ) );
        
    if( $getposts ){
        $display = '';
        $display .= '<ul>';
        foreach( $getposts as $post ) {
        setup_postdata($post);
        $display .= "<li><a href=\"" . get_permalink() . "\>" . get_the_title() . "</a></li>";
    }
        $display .= '</ul>';
        wp_reset_postdata();
        echo $display;
        }//
    
    
    Code (markup):
     
    snaroliya, Mar 16, 2019 at 1:13 AM IP
  3. Rashida H.

    Rashida H. Peon

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #3
    Hi there,
    Thanks for the quick reply.
    Quick point though; I don't have "posts" in categories. I have made categories in pages. And I just want to show my 5 main categories in the footer.
    So, how can I display those with this code?
    Also, quick question: where do I place this code? which file?

    Kindly advise.
    Thanks!
     
    Rashida H., Mar 16, 2019 at 8:24 AM IP
  4. snaroliya

    snaroliya Member

    Messages:
    48
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    45
    #4
    How did you make categories in pages? wordpress don't have categories in pages by default?
     
    snaroliya, Mar 17, 2019 at 11:05 PM IP
  5. Rashida H.

    Rashida H. Peon

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #5
    My bad! Actually, I made pages only. But since in my website layout, I have named those pages as my categories - so I ended up saying the same here. I apologize.
    Yes. So technically there are 5 pages that I want to mention in the footer under "Categories". I went into "Appearance" - "Menu" and add these 5 pages in "footer menu" under categories there as well .. but it doesn't display on the website.
    I hope, am not confusing you.
    Let me know, please!
     
    Rashida H., Mar 18, 2019 at 9:49 AM IP