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.

    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
  2. snaroliya

    snaroliya Active Member

    Messages:
    51
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    95
    #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 IP
  3. Rashida H.

    Rashida H. Peon

    Messages:
    25
    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 IP
  4. snaroliya

    snaroliya Active Member

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

    Rashida H. Peon

    Messages:
    25
    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 IP
  6. salmanshafiq

    salmanshafiq Well-Known Member

    Messages:
    260
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    128
    #6
    Best way create a menu for those category page and display that in the menu in the footer through widget.
     
    salmanshafiq, Mar 23, 2019 IP
  7. Rashida H.

    Rashida H. Peon

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #7
    Hi @salmanshafiq:

    Thanks for your guidance.

    I have created the menu for the category pages and displayed the menu in the footer as well. But, the way I want to display is: after categories - the 5 pages (Gas Detection etc) needs to align little right so the user see these pages as part of the categories.
    For your reference:
    upload_2019-3-25_12-59-31.png

    WEBSITE URL: https://www.directsupplyservices.com/

    Kindly advise, how can I do this.
    Thanks & Regards,
    Rashida H.
     
    Rashida H., Mar 25, 2019 IP
  8. pentaxial

    pentaxial Active Member

    Messages:
    101
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    78
    #8
    "Category" Free plugin is available - you can manage category with Image also , then at footer.php- using the custom query- you can call the category
     
    pentaxial, Mar 27, 2019 IP
  9. AttaboyRoi

    AttaboyRoi Member

    Messages:
    26
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    33
    #9
    If you still need this done, here is what it would look like...

    Screenshot_directsupplyservices.png
     
    AttaboyRoi, Apr 21, 2019 IP
  10. BITNETHOST

    BITNETHOST Active Member

    Messages:
    53
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    98
    #10
    is this problem solved ? are you still looking for a solution ?
     
    BITNETHOST, May 23, 2019 IP