WordPress.org

Support

Support » Themes and Templates » Listing one category's posts as featured images?

Listing one category's posts as featured images?

  • Hey guys! Been searching around the net now for a solution to this, but I’m a bit confused, so went in here to maybe get some pointers. 🙂 I basically want to list one specific category on a page, showing all the different posts’ featured images in a grid.

    Kind of like it’s done here;
    http://www.planet.mu/artists

    That’s probably not WordPress, but you get the idea. Is there a way to do this without having to code a lot of PHP? I’m not very good with PHP, you see, so would be nice if there was an easier solution. If the only solution is to use PHP, then I could always try.

    Any input on this would be much appreciated! 🙂

Viewing 15 replies - 1 through 15 (of 19 total)
  • So the solution will be PHP, but not that much 😉

    1.
    Did you use a custom theme, created by yourself? If not, you should create a child theme, then we will do the rest – together 🙂

    How to create a child theme: http://codex.wordpress.org/Child_Themes

    to be continued – after your answer 🙂

    Hey, and thanks for the reply! 🙂 I’m using a premium theme called Scope, it’s really nice, but I’ve just found out that it outputs posts a bit weird, so I’m going to opt for using pages instead. Might not be the best solution, but I think it will be less of a hassle (at least if my plan works out).

    Thinking about just popping some nice columns into one main page, putting the images with links to the artist pages within those columns. Hopefully it will work.

    But thanks a lot for your reply, I really appreciate it! 🙂

    Good luck 🙂

    Damn, I can’t really figure it out.

    Can the method you are referring to also work with listing pages in a grid? 🙂 If it can, I’m all ears!

    I’m using this theme;
    http://themeforest.net/item/scope-agency-business-wordpress-theme/full_screen_preview/952938

    Should I then also create a child-theme? 🙂

    Pages won’t be the best solution for your needs. Your first plan would be much greater 🙂

    The Plan, lets try to make it clear 🙂
    You want to create a special post category (eg. artist-portraits), which won’t be shown together with the “normal” blog posts in the stream. The artist-portraits category posts should be shown on a special page (eg. Artists) only with the featured image assigned to them.

    Is this correct?

    Child Theme
    Yes, if you want to edit the theme like adding functions or changing the html markup, you should create a child theme. Why – If you make changes to the theme core files, they will be lost during the next theme update 🙂

    That is correct! 🙂 The reason I don’t want to use “posts” is because of the regular post output (which shows author, date, comments etc, which I don’t want) – but I guess this could be fixed with a child theme?

    I’m so tired at the moment, that I have to go to bed. But I will check back here when I have created a child theme! Thank you so much for your help already, I really appreciate it. Is there any way to give away “props” on this forum? There are always so many helpful people here. 🙂

    Don’t be afraid of the posts output 🙂 We will create a special page template for your special category which will fit all your needs 🙂

    1. Create the childtheme and make it work 😉
    2. Copy the page.php from the parent theme directory to your child theme directory, then rename it (in your child theme directory) eg. my-artist-page.php – something meaningful to you 🙂
    3. Open it with a text-editor, copy all the code and paste it here through http://pastebin.com/
    4. Create your “special post category” and tell me the name 🙂
    5. Create the “page” (in your dashboard) where you want to output the special category posts (eg. The Artists)
    6. Tell me the link to your upcoming wordpress website 😉

    Let me know if everthing is done 🙂 so we can add some magic =)
    Good night 🙂

    Thank you so much, man. 🙂 Let’s see, here is the page located;
    http://www.marsmelons.com/artists/

    The category is called “Artists”. And here is the pastebin;
    http://pastebin.com/CWhy88Lq

    I’m not sure if the child-theme works, but I assume it does, as I have followed the instructions carefully.

    So, where to go from now? 🙂

    I have absolutely no idea how you made the “splash” on that website of yours by the way, but it looks friggin amazing! 😀

    Hi there,

    I will take you to the further steps if I’am at home, haven’t enough time to write it down here at work 😉

    But one question, which size should the artist images have? For a nice grid, they all should have the same, but which size do you prefer? 🙂

    The website splash is just a customnized jQuery Plugin: http://motyar.blogspot.de/2010/04/firefly-jquery-animation-plugin.html

    😉

    stay tuned…

    Cool, thanks, man. 🙂 The artist images should be sized 220px wide and 140px high (this is the same as the featured images on my release-page, so figured it would look nice). Very cool plugin!

    Well ok 🙂
    Some very very last questions before I can start…

    1.
    Should the page “Artist” just be a list of the artists, I mean would you like users to click on an artist, that they will get more information or just a list without further information? If you want to add further information (a artist single-post-view, like your other blog posts) I also need the code of your parent themes single.php through http://pastebin.com/

    2.
    Can you please check the parent themes function.php for something like add_image_size( 'title-of-the-size', 220, 140, true); I need the title-of-the-size to output your prefered featured image size 🙂

    1. I’d like you to be able to click the image and get to an artist page/post, where there is more information on the clicked artist, very much like at Planet Mu;

    http://www.planet.mu/artists

    I’d also really like to check out how it would look with the name of the artist in plain text underneath the picture, like name of “post” underneath featured imaged, to see if that looks best. Is that possible?

    Here’s my single.php;

    http://pastebin.com/c9bHy9aB

    2. I believe this is the piece of code?
    add_image_size( ‘portfolio-thumb’, 220, 140, true); // for the portfolio template

    So ‘portfolio-thumb’. 🙂

    Thanks a lot for helping me, man. 🙂

    Ok lets get go 🙂

    1. Open your child theme functions.php and paste in the following:
      /**
       * Exclude category
       * Exclude posts with the category "Artists" from the main query (post stream) and the rss feed
       */
      function mars_melons_exclude_category($query) {
       if( $query->is_main_query || $query->is_home || $query->is_feed ) {
         $artist_category_id = get_cat_id(artists);
         $query->set('cat',"-$artist_category_id");
       }
      return $query;
      }
      add_filter('pre_get_posts','mars_melons_exclude_category');

      This will exclude all posts with the “Artists” category from your main blog posts and the rss feed… if not, just let me know.

    2. Create the folder “images” in your child theme directory and upload this image (through your ftp) into it: http://www.egado.de/wp-support/default-artist-image.png maybe you like to change it, this will be the fallback image, if no featured image is set 😉
    3. Create the file “artist-list.php” in your child theme directory an paste in the following: http://pastebin.com/dFUpQWtn save it, upload it.
    4. Paste the following CSS into your child theme style.css http://pastebin.com/8f8tVAzh
    5. Go to your dashboard, edit the “Artist” page. Select the template “Artist-List” (right sidebar) and save the page. If you can’t select the template, maybe your child theme don’t work correctly.
    6. Go to your dashboard, add 6 posts with the category “Artist” as examples. Leave at least one featured image blank.
    7. Lets have a look at the results, guess we have to do some little style fixings 😉 its hard to code without the ability to test it with the template. :/

    Let me know whats going on 🙂

    //EDIT
    !!!!!
    I have changed a pastebin link and some other details, so please don’t use the links or the code from the automatic forum e-mail 😉

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Listing one category's posts as featured images?’ is closed to new replies.
Skip to toolbar