Skip to:
Content
Pages
Categories
Search
Top
Bottom

Couple of hints for theme developers


  • Markic
    Participant

    @markic

    First of all, I’m not asking any questions, I’m offering solutions for people who, like me, had these specific problems, are googling for a solutions and can’t find any. Some of you think this is pure amateur stuff, but there are people out there who will spend hours trying different things and this can save them so much time. If you want to delete this topic, I don’t care, I’m here to help…

    How to load bbpress.css before your yoursheet.css?
    Intro: When WordPress is loading stylesheets, they’ll load all the theme .css files first and then they’ll load plugin css. That way plugin css has higher priority than your css and only way you can override it is with !important. As we all know, that is a bad practice.

    Also, you can create your own bbpress.css in your theme but that means more files to keep up with (although, that’s the cleanest solution). Here’s another way to do this:

    paste this code into functions.php…

    if (class_exists('bbPress')) {
    add_action( 'wp_print_styles', 'deregister_bbpress_styles', 15 );
    function deregister_bbpress_styles() {
    wp_deregister_style( 'bbp-default' );
    }
    wp_enqueue_style( 'bbpress_css', plugins_url().'/bbpress/templates/default/css/bbpress.min.css');
    }

    So, let’s get into details:
    – first, if you have active plugin ‘bbPress’ it will exicute the following code which removes all the .css files from it
    – second, it loads bbpress.min.css again, but this time where you want it…
    – be sure that you enqeue your stylesheet after this code

    Note: there are two problems that might arise from this techique
    -if bbPress developers decide to rename, remove or split bbpress.min.css, you’ll have to change the code again
    -there’s other .css file named “bbpress-rtl(.min).css”. Well, some cultures (Arabic), read and write from right to left. And what this file aligns everything to the right. bbPress has some system of deciding whether it should load this file or not, but by doing this technique, you’re disabling that system.

    How can I remove all the breadcrumbs from the templates and set them at the top of the page?
    Intro: Many of us are creating our own themes with existing breadcrumbs systems which are in the header. But bbPress has it’s own idea where to display breadcrumbs, and sometimes that’s at the top of the page, sometimes that’s below search form and sometimes it’s below title. Here’s how you can change that quickly.

    1. If you haven’t, create “bbpress.php” in the root folder of your theme. (You can copy-paste page.php)
    2. Add
    <div class="truebreadcrumbs"><?php bbp_breadcrumb(); ?></div>
    where you wan’t to show your breadcrumbs
    3. Add this CSS:

    div.bbp-breadcrumb {
    display: none; /*this will hide all breadcrumbs*/
    }

    .truebreadcrumbs div.bbp-breadcrumb {
    display: block; /*this will display breadcrumbs you've created*/
    }

    Sure, HTML will still generate all the breadcrumbs and css will hide the unwanted ones, but this is the easiest way to do this without going into templates…

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar