Before you ask please READ THIS

Excluding a genre from albums list

edited July 2014 in Hypershot Posts: 67
Hello Air,

I apologize in advance if this question has been answered already. I tried to apply the suggestions in these two topics, but I can't seem to achieve the results that I want:
http://support.apollo13.eu/discussion/1496/featured-on-homepages#Item_4
http://support.apollo13.eu/discussion/884/a-selection-of-albums-for-the-frontpage

Scenario: I have a specific album showing on the front page. This album uses the full theme, with thumbnail list enabled, which means that the user can view the other albums on the front page as well. These albums belong to certain different genres, for example, W, X, Y, and Z. I would like to create another genre, say, AAA, wherein those belonging to X and Y also belong to this genre AAA.

My goal: On the front page, I would only like to show albums (through the thumbnail list) belonging to genre AAA. And then, on the albums list page, I would like to remove genre AAA from the list of filter categories. That is, when the user wants to filter the albums by genre, he will only see genres W, X, Y, and Z as options, but not AAA.

I hope I was able to make myself understood. :S

Thank you in advance for your help.

Regards,
LazyDiver

Comments

  • AirAir
    Posts: 10,970
    Hello

    You have found very good topics so what didn't work for you there?

    With regards.
  • Posts: 67
    Hello,

    The scenario remains the same and I didn't achieve my goal. :)

    Regards,
    LazyDiver
  • Posts: 67
    I think it's because the topics covered modifications to a bricks theme, while I am using the full theme. Instead of changing this part in front-page.php:
    elseif($fp_variant == 'albums_list'){
    get_template_part( 'albums_template' );
    }
    I changed this part:
    elseif($fp_variant == 'album'){
    global $wp_query;

    I still didn't get the result that I wanted for the front page.

    I also tried to insert in album-list.php the codes (2 options) that were mentioned in the topics, but they did not work.

    Could you please guide in making it work for the full theme (1 album) option?

    Thank you.
  • AirAir
    Posts: 10,970
    LazyDiver said: I think it's because the topics covered modifications to a bricks theme, while I am using the full theme
    In full theme there is no filter:-) This is only designed for bricks cause there it makes sense.

    If just wish to hide album that is used on front page, then set it as Use only as background http://apollo13.eu/docs/hypershot/#!/adding_album_add_new_album

    With regards.
  • Posts: 67
    Hello Air,

    But if I set the album to 'use only as background', it won't show up on my albums list page (which is another page that uses the bricks layout), correct? I just want to hide it on the front page in order to streamline the look. But I still want to show all albums on my albums page with a specific genre "label" excluded from the filter list.

    Thank you.
  • AirAir
    Posts: 10,970
    I think I need to see what your pages look like now, cause I am getting lost.
    Please post live link:-)

    With regards.
  • Posts: 67
    Just sent you a two-part PM. :)
  • AirAir
    Posts: 10,970
    I don't see any PM, are you sure you did it by forum?
  • Posts: 67
    Oops. I just re-sent the PM.
  • AirAir
    Posts: 10,970
    Hello

    About excluding from "small Albums list" - simplest way would be to do it by CSS. I can prepare it for your front-page, if you like:-)

    About normal albums list and excluding genre - you will have to do following changes:
    albums-list.php line ~25 change this:
        $args = array(
            'posts_per_page'      => $per_page,
            'offset'              => $offset,
            'post_type'           => CUSTOM_POST_TYPE,
            'post_status'         => 'publish',
            'ignore_sticky_posts' => true,
            'meta_key' => '_background_only',
            'meta_value' => '0',
        );
    to:
        $args = array(
            'posts_per_page'      => $per_page,
            'offset'              => $offset,
            'post_type'           => CUSTOM_POST_TYPE,
            'post_status'         => 'publish',
            'ignore_sticky_posts' => true,
            'meta_key' => '_background_only',
            'meta_value' => '0',
            'tax_query' => array(
                array(
                    'taxonomy' => 'genre',
                    'field' => 'slug',
                    'terms' => array( 'girls' ),//here you define excluded categories
                    'operator' => 'NOT IN'
                )
            )
        );
    Next line ~62, change
    $terms = get_terms('genre', 'hide_empty=1');
    to:
    $terms = get_terms('genre', array('hide_empty' => 1,'exclude' => '13'));
    In this case you have to use id of genre you need to exclude.

    Hope that helps.

    With regards.
  • Posts: 67
    Hi Air,

    Thanks for the code, it worked! I only changed line~62 because I still wanted to show all the albums on the album list page. I just needed to hide a specific genre from the filter terms list. But the rest is good for future reference. ;)

    Regarding the 'small albums list' on the front page, I would like to have a go at it, if you don't mind. Could you please send me the code that needs to be added to the child theme's style.css and I'll see if I can get it to work? I'll holler if I encounter any problems. :)

    Regards,
    LazyDiver
  • AirAir
    Posts: 10,970
    Hello

    You will have to use CSS like this :
    body.postid-6 #other-albums a{
        display: none;
    }
    body.postid-6 #other-albums a[data-id="145"],
    body.postid-6 #other-albums a[data-id="146"]{
        display: inline;
    }
    Explanation:
    postid-6 - this is id of album on front page
    [data-id="145"] - these are albums that are in this special category. You have to use here IDs of these albums.

    With regards.
  • Posts: 67
    Hi Air,

    That worked, thanks! Wondering if we could also include in the CSS hiding the separators, which are the forward slashes ('/') that come between the album names? :)

    I just have to remember to update the stylesheet every time I update my front page. :D

    Cheers,
    LazyDiver
  • AirAir
    Posts: 10,970
    Hello

    You can use such custom CSS
    #other-albums > span {
    display: none;
    }
    Hope that helps.

    With regards.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion