Home / Forums / DynamiX Support / exclude category in blog template

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts

  • michael Painter
    Participant

    Hi ive got a lot of categories in a hierarchy list that I want to show in a blog tempalte page, th eissue I have is I want to keep the hierarchy but not show some of the categories in the blog template.

     

    E.G: Category Hierarchy – Cars/British Cars/Sports Cars/News

     

    I want to call the Cars category in the blog template but not have the contents of the News category to load in the template.

     

    I want to keep teh hierarchy so the breadcrumbs retain “Cars/British Cars/Sports Cars/News” when on the news page.

     

    Any assistance would be gratefully recieved, i’m in the middle of a big build and suddenly realised I can’t get teh above to work which throws out the structure completely.

     

    Kind regards,

     

    Mike

    Andy
    Andy
    Keymaster

    Hi Mike,

     

    Unfortunately that’s not possible – it’s one or the other. The breadcrumbs would work on normal blog pages but you can’t filter your categories and blog page will just show the breadcrumbs to that page and not the categories associated with it.


    michael Painter
    Participant

    I’m sorry not sure what you mean by one or the other.

     

    I would like the blog to show every category in a list of categories except one. I could use a recent post shortcode and name the categories I want to show only but when they are into the hundreds and all are a hirearchy of one category it would be a pain to do it that way, is there anyway to hack into the loop and express which categories to not show or on the recent post shortcode express the category to not show.

     

     

    Andy
    Andy
    Keymaster

    Hi Mike,

     

    Your best bet would be to hack the recent posts short code – but it’s not so straight forward. Hacking it would change it for all recent posts short codes. If you’re not using it elsewhere then you can do the following.

     

    Edit DynamiX/lib/inc/shortcodes.php – locate this line

     

    $q = new WP_Query(‘offset=’.$offset.’&orderby=’.$order.’&order=’.$orderby.’&category_name=’.$categories.’&posts_per_page=’ . $limit);

     

    change to the following – change the -99 to your category ID which you want to exclude.

     

    $q = new WP_Query(‘offset=’.$offset.’&orderby=’.$order.’&order=’.$orderby.’&cat=-99&posts_per_page=’ . $limit);


    michael Painter
    Participant

    Cool Thanks ndy i’ll give it a try.

     

    Regards Mike

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.