Viewing 21 posts - 1 through 21 (of 21 total)
  • Author
    Posts
  • #11820

    Is it possible to make a category invisible in the blog page, but accessible from a separate link item in the menu?

    #73175

    Hi lotsdesign,

    You could hide the category then go to Appearance > Menus > Categories > Add category to menu. This is the code you’ll need to add to your custom.css or Quick CSS to hide the category from displaying on the Blog.

    .blog-categories {
    display:none;
    }

    Regards,

    Mya

    #73176

    Thanks Mya! In that line of code, should i also include the name of the category i want to hide? And where?

    In our case we have a Blog page on the site. On the blog we have a couple of categories. We use the blog function as our news section.

    But we want to have another section called “Trends” which also works as a blog works, with posts. But it should be displayed separately from the news-blog. Do you follow?

    So that’s why i though of making a category for “trends” and display int as a item in the menu. But it also shows up at the news blog as a category.

    Thanks!

    #73177

    Hi lotsdesign,

    I see. Okay, totally ignore my first response then. :) I was thinking you wanted to simply hide the category from displaying on the blog page along with the post date, comments, etc.

    For what you’re looking to do, you need to do edit the query on either template-blog.php or loop-index.php. Let me flag the other support team members to this thread to see if they give you specific instructions.

    Regards,

    Mya

    #73178

    You can modify the query in template-blog.php – open up the file and replace:

    $avia_config['new_query'] = array( "paged" => get_query_var( 'paged' ), "posts_per_page"=>get_option('posts_per_page') ) ;

    with:

    $avia_config['new_query'] = array( "paged" => get_query_var( 'paged' ), "posts_per_page"=>get_option('posts_per_page'), 'category__not_in' => array( 2,6 ) ) ;

    and instead of the categories (with the id) 2 & 6 enter your category ids you want to exclude. Seperate the ids with commas ( , ).

    #73179

    What would be the opposite be for including only certain categories? (as opposed to excluding specific ones)

    Also, could I duplicate template-blog.php to something like template-press.php to load as a template with another specific set of post categories?

    Would I be able to for instance then duplicate index.php, call it ‘page-press.php’ with the template part string of “get_template_part(‘template’,'press’);” to load said template as an alternate blog page?

    Or is there just a way to pass an overriding query to the page-press.php page that includes the standard template-blog.php file?

    Thanks,

    Michael

    #73180

    The opposite would be:

    $avia_config['new_query'] = array( "paged" => get_query_var( 'paged' ), "posts_per_page"=>get_option('posts_per_page'), 'category__in' => array( 2,6 ) ) ;

    A list of all parameters can be found here: http://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters

    #73181

    Hey Dude – been gleening loads of answers to my questions from here (so many thanks!) – but 2 things i can’t see the answer to….

    1) I want to remove the category / author link below each blog post. I have done this successsfully, using the following 2 css codes:

    .blog-author.minor-meta {

    display: none;

    }

    .blog-categories {

    display:none;

    }

    However, there still remains a forward slash (“/”) which used to divide the category and author names. How do i remove this forward slash that remains?

    2) Below each new post in the blog, there should be a “read more ->”, but mine has dissappeared :( How do i get this back for all posts, so visitors don’t have to click the title but can also click “read more” too?

    Thanks so much!

    Alex

    #73182

    Hi Alex,

    Can you link us to your site and the blog page that isn’t showing the read more link any longer?

    Regards,

    Devin

    #73183

    Hi Dude,

    I tried your code for excluding categories but it didn’t work. The category ID I used was 114 – can that be right? I got it from the manage>categories section and in the URL.

    Is it possible to use the category slug instead of ID number?

    Thanks, Siobhan

    #73184

    Hey!

    I checked the docs here: http://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters and afaik category__not_in does not support category slugs/names.

    Regards,

    Peter

    #73185

    Hey,

    Thanks for letting me know.

    This is what my code looks like, is there anything I’m missing?

    The numbers 114, 115, 116, 120 are all category IDs, so not sure where I’ve gone wrong.

    $avia_config = array( “paged” => get_query_var( ‘paged’ ), “posts_per_page”=>get_option(‘posts_per_page’), ‘category__not_in’ => array(114, 115, 116, 120) ) ;

    Thanks! Siobhan

    #73186

    Hi!

    Yes, it should work this way. Are you using the default blog template?

    Regards,

    Peter

    #73187

    Hi Peter,

    I’m using the template-blog.php for the Corona theme, is that right?

    Thanks, Siobhan

    #73188

    Hi Siobhan,

    Yes, that’s the template used for the blog page (Corona).

    Regards,

    Ismael

    #73189

    Thanks Ismael.

    I’ve tried both the codes above – one to exclude certain categories and one to include and it doesn’t seem to work either way. Is it possible to use the other parameters in the code instead, e.g. $query = new WP_Query( ‘category_name=staff’ );

    I have a few different categories but two parent categories which I don’t want showing at the same time. So when I go to this page http://etool.net.au/eblog/ I just want the eBlog parent category and child categories showing (Not Support) and on the following links,

    http://etool.net.au/category/support/

    http://etool.net.au/category/support/features/

    http://etool.net.au/category/support/tutorials/

    just the Support parent category and child categories Features, Software Help, Tutorials.

    Could you advise the code to use with this other parameter using the category slug please?

    Also, could you advise the CSS to use to get the archive category titles a specific colour rather than black e.g. color: #107670;

    Thanks, Siobhan

    #73190

    Hi,

    Here is 6 different dark colored titles/headings i saw on the main page, i labeled some, but was a bit confused about a few, just pop them in one at a time into custom.css, and see the change that was made. You will need to replace the color with the #xxxxxx hex code that you

    /*blurb of text on slide during rollover?*/
    .slideshow_caption {
    color: black;
    }

    /*slider title on roll over?*/
    .slideshow_caption strong
    color: #CF1212;
    }
    /*slider title on roll over?*/
    #top .slideshow_caption h1 {
    color: #CF1212;
    }
    /*blurb of text on slide during rollover?*/
    .featured_caption {
    color: #444;
    }

    h1, h2, .relThumbHeading {
    color: #333;
    }
    /*horizontal line center heading text*/
    .custom_hr_text {
    color: #222;
    }


    Please take a look here, http://wordpress.org/support/topic/listing-child-categories-and-posts-1 , there are 5 blocks of code , I would only keep my eye on block # 2 pr 3 (though looks like 3 hardcoded the ID number)

    You can try on this page, just substitute the number 10 with the parent category number you want to show. http://www.wpbeginner.com/wp-themes/how-to-display-only-child-category-in-your-wordpress-post-loop/

    This is the function described

    http://codex.wordpress.org/Function_Reference/cat_is_ancestor_of

    This is the basic logic when comparing 2 categories to see if one is the ancestor of another, except you would use variables obviously as in the previous example.

    if ( cat_is_ancestor_of(6,20) ) {
    echo '<p>Category 6 is an ancestor of category 20 </p>';
    } else {
    echo '<p>Category 6 is NOT an ancestor of category 20 </p>';
    }


    This is for finding parent categories from a child explained http://codex.wordpress.org/Function_Reference/get_category_parents

    If you search on google for ‘wordpress parents categories’ and ‘wordpress child categories’ as I have, there is tons of tutorials, reference and diagrams. Cool stuff!

    Thanks,

    Nick

    #73191

    Hi Nick,

    Thanks for the reply.

    I’ll have a look at all the links you’ve suggested – the process seems to be a bit more complicated than I thought just to exclude a category so will spend some time reading up!

    For the archive category font, the code you’ve suggested is from the website homepage rather than the archive category page e.g.

    http://etool.net.au/category/support/

    I’m just looking to change the colour of the title ‘Support’ from black to green. I’ve found this CSS code in another Kresi forum (with a different colour code) but it doesn’t seem to change the colour at all.

    .blog-meta .post-meta-infos span.blog-categories a {

    color: #272727 !important;

    }

    Please can you advise whether I’m on the right track?

    Thanks, Siobhan

    #73192

    Hi,

    You would use this to change the color of the word Support on the link you provided,

    #top.archive span.container {
    color: green;
    }

    You should install Google Webdeveloper Tools for Chrome browser, or FireBug for FF/Chrome/Safari, Using them you can easily style the entire page in 15 minutes without knowing css. It’s what I use, since it does all the thinking. lol. Watch this quick video https://docs.google.com/open?id=0B8hqGBMSfHtKN3RxWXhwZ1c4WGM

    Thanks

    Nick

    #73193

    Hi Nick,

    Thanks a lot for the code and info about CSS, I’ll give it a go!

    Used the code and works fine. Also found two plugins – Easy Category Management and Ultimate category excluder.

    I’ve managed to exclude the Support posts from the eBlog page which is great, but what I’m looking to do is hide the Support category from the sidebar widget when on the Blog homepage, and on the different support pages, hide the eBlog category.

    So on the blog homepage, the eBlog category would be collapsed in the sidebar widget and no support category showing and on the support archive category, the support category would be collapsed in the sidebar widget and the eBlog category hidden.

    I don’t think this is an issue with parent/child categories as they are both parents.

    To get the collapsible categories, I used Collapsing Categories plugin which has the option to exclude a category which I have done with Uncategorized, but doesn’t seem to allow more than one or choose to hide by different archives/pages.

    I’ve had a look through the code and can’t really get my head around it. The codes I’ve used in previous suggestions haven’t worked either – not sure if it’s an issue with placement in the theme.php (I’ve tried it in a few places) or which the category ID which I’ve double checked and seem to be correct.

    Any help would be really appreciated!

    Thanks, Siobhan

    #73194

    Hi,

    Add Widget Context Plugin and use it in conjunction with Easy Category Management. or you can use http://wordpress.org/extend/plugins/frontpage-category-filter/ this plugin alone, just add 2 copies of it, and set one copy to show on one page and another to show on a different page, this way in the first copy you can block one set of categories and in another copy you block out another set.

    In any case get widget context also http://wordpress.org/extend/plugins/widget-context/ .. this plugin lets you add logic to any widget .. conditional statements, so that you can put 20 copies of the same widget into a sidebar, and have each copy display only when on a certain page or category, or to children of category, etc.. You can use any conditional tag (its easy, no code just tag)

    http://codex.wordpress.org/Conditional_Tags

    Here is a video on how to use it http://www.youtube.com/watch?v=NXp7LkN0S9E

    Watch it, and here is tutorial. Just follow along! http://www.ostraining.com/blog/wordpress/widget-context/

    Best thing to get your head around something, is to follow a video or step by step and doing it without understanding, and then all of a sudden later start understanding it. At least for me. But i’s frustrating and managing stress/frustration is the worst part of learning this stuff.

    Thanks,

    Nick

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

The topic ‘Hide a category from blog?’ is closed to new replies.