• At the link below, in the secondary navigation bar (inline with the ‘Search Products’ button), if you hover over — for example — “Diabetes Tests”, you’ll see:

    Glucose(8)
    HbA1c(7)

    This would look better if there was some padding between the end of the product category title and the () showing the quantity. For example, it should look like this in the top right of the header:

    CART (0)

    So I tried adding some padding via CSS, but that’s all part of the same element …. So then I was looking at the various theme PHP files, but I’m not seeing which file has that element.

    I’m assuming if I can find the applicable PHP file, then I can add a space there and solve the problem. But it appears that I’ll need a little input on whether this assumption is correct, and (if so) which PHP file should be edited.

    Thanks for your help,
    Jim

    • This topic was modified 7 years, 5 months ago by jimmb. Reason: changing "above" to "below"

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    You could do this with a filter on the_title… Something like

    function wpforo_add_space_in_menu ( $title ) {
            if( !is_admin() && !in_the_loop() ) {
                    $words = explode( '(',  $title );
                    $words[0] = $words[0] . ' ';
                    $title = implode( '(', $words );
                    }
            return $title;
    }
    add_filter( 'the_title', 'wpforo_add_space_in_menu' );

    I didn’t test this. I modified something I’m using a site and it should work. You may have to play with the conditions in the if.

    Add this to your theme’s functions.php or make a quick plugin to hold it.

    Thread Starter jimmb

    (@jimmb)

    Hi Steven, thanks for the reply! I just tried adding that code to the theme’s “functions.php” file, but I didn’t see anything change afterward.

    Tomorrow I should have someone else in the office who is a programmer (technically a student in computer science) look at it…

    But I’m guessing he’ll be wondering if there are any suggestions for specific types of things to play with in the ‘if’ condition section.

    Alternately, is there an easy way to give either the product category label or the quantity (or both) a class? Then I could just add some padding in the CSS file and be done with it.

    Thanks for any further suggestions or advice,
    Jim

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Adding Space Between Product Categories & Quantity’ is closed to new replies.