Tag Info

Hot answers tagged

5

Didn't work for me, but I found a nice fix. In your header.php use the wordpress function to query if the toolbar is displayed, and then create an empty div below the navbar div: <div class="navbar navbar-inverse navbar-fixed-top"> <?php // Fix menu overlap bug.. if ( is_admin_bar_showing() ) echo '<div style="min-height: ...


4

For a copy paste solution check this custom Walker out: http://goodandorgreat.wordpress.com/2012/01/12/update-2-using-twitter-bootstrap-dropdown-menus-with-wordpress/ It's missing one or two things like data-toggle="dropdown" and <b class="caret"></b>. It should be quite easy to figure that out, but here's my modified version: ...


4

Almost. Put the bootstrap stuff in your theme, and include it on the front end using wp_enqueue_style and wp_enqueue_script in functions.php e.g. for the bootstrap js: function my_scripts_method() { wp_enqueue_script( 'bootstrap-js', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery') ); } ...


3

You will need to write a custom walker extending Walker_Nav_Menu, more or less like so: class My_Custom_Nav_Walker extends Walker_Nav_Menu { function start_lvl(&$output, $depth = 0, $args = array()) { $output .= "\n<ul class=\"dropdown-menu\">\n"; } function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { ...


3

The above looks correct, however, you need to specify your script to enqueue after bootstrap by adding the bootstrap-min handle to the third, dependencies parameter. function register_css() { wp_register_style( 'bootstrap-min', get_template_directory_uri() . '/css/bootstrap.min.css' ); wp_register_style( 'custom-css', get_template_directory_uri() . ...


3

Currently it is practically impossible. Need write your own version of the function. I did just so for my theme in development. There is a trac ticket requesting improvements to the function since it is inflexible, yet required for themes hosted in official repository.


2

I just ran into this issue as well, the cause of this is that at 600 pixels wide the admin bar goes from being position:fixed to position:absolute; When fixed, it is locked to the top of the screen (top:0) When absolute it is locked to the top of the closest container that contains it. This is the html element by default, but if a parent is defined to have ...


2

The following should setup your menu with the correct classes and IDs applied to your container and ul. The codex entry for wp_nav_menu lists all the possible arguments. wp_nav_menu( array( 'theme_location' => 'primary', 'container_class' => 'menu-menu-container', 'menu_id' => 'menu-menu', 'menu_class' => 'btn-group' ) ); ...


2

You can do it in two ways.... Solution One: <?php add_action( 'wp_head', 'myscript' ); function myscript(){ echo '<!--[if lt IE 9]><script src="your_js_file_path"></script><![endif]-->'; }; ?> Solution Two: <?php global $wp_scripts; wp_register_script( 'jsFileIdentifier', 'YourJsFilePath', array(), '3.6.2' ); ...


2

As mentioned on the wp_register_script() codex page the handle: Should be unique as it is used as a handle for later use with wp_enqueue_script(). You are using the same handle for all your scripts, which won't work. Besides that, if those scripts are depending on bootstrap, you have to at least register bootstrap before and add it as dependency to ...


2

you can try this: .navbar-fixed-top { top: 0px; } body.admin-bar .navbar-fixed-top { top: 28px !important; } if that does work for you (which it should!), then you'll have to move the wp admin bar to the bottom by sticking the code below into a plugins folder or your functions.php file: function fb_move_admin_bar() { echo ' <style ...


2

Few things you shouldn't forget when using JS in your WordPress theme. You should use wp_enqueue_script to include scripts - you can create JS conflicts if you include them manually. You have to maintain correct urls to these files - in your sample source code you include them using relative paths. (Using relative urls isn't wrong, but you have to be sure ...


2

Filter 'wp_nav_menu_args'. add_filter( 'wp_nav_menu_args', 'wpse_79901_nav_menu' ); function wpse_79901_nav_menu( $args ) { $args['items_wrap'] = '<ul class="nav nav-pills">%3$s</ul>'; return $args; }


2

you would have to do something like this <?php wp_nav_menu( array( 'sort_column' => 'menu_order', 'container_class' => 'menu-header' ) ); ?> The container class you can change your class add more class


2

I used a different approach than a custom walker. I used a function to add the class "dropdown" to any parent nav items which contain sub menu items. Since WordPress outputs the class "sub-menu" by default, I use jQuery to add the class "dropdown-menu" to any thing that has a class of "sub-menu". I then use jQuery to append the <b ...


2

The script First you have to enqueue the script. We conditionally load it only for your custom post type and its archive(s). // in your functions.php function wpse69274_enqueue_tbs_collapse() { if ( ! is_post_type_archive() AND 'YOUR_POST_TYPE' !== get_post_type() ) return; wp_enqueue_script( 'tbs-collapse' ...


2

use do_shortcode($content) instead of $content in first function(collapsegroup)


1

I am admittedly out on a limb here because to test this I'd have to install your code and create some menus to test it with, but... Look in the Bootstrap_Walker_Nav_Menu code. Find this: $item_output .= '<a'. $attributes .'>'; $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after; ...


1

I've found that for things like this, get_posts is easier. <?php // Set up your arguments array to include your post type, // order, posts per page, etc. $args = array( 'post_type' => 'testimonial', 'posts_per_page' => 3, 'orderby' => 'date', 'order' => 'DESC' ); // Get the posts ...


1

It didn't work for me until I added this to the body tag: <body <?php body_class(); ?>> Then it worked fine!


1

Check out the WordPress Bootstrap CSS plugin. It seems to contain "handy shortcodes" to insert all sorts of elements. Also check out Obenland's The Bootstrap WordPress theme that was released a week ago.


1

I had a try with that. You'll need Twitter Bootstrap's CSS file, Bootstrap Switch's CSS and JS files. I put all those three files in a folder called assets. functions.php: <?php add_action( 'wp_head', 'rr_bootswitch_meta' ); add_action( 'wp_enqueue_scripts', 'rr_bootswitch_enqueue' ); function rr_bootswitch_meta(){ print '<meta ...


1

To add that last list item, you don't need a custom Walker. There is a hook that will allow you to tack that on. function add_last_nav_item($items) { return $items .= '<li><a href="#myModal" role="button" data-toggle="modal">Contact</a></li>'; } add_filter('wp_nav_menu_items','add_last_nav_item'); It wouldn't be start_el and ...


1

You are loading jQuery 1.8.3 and jQuery 1.9.1. 1.8.3 loads from wp-includes. 1.9.1 loads from Google. Install JSView on FireFox and right click the page. You will see them. There are two Javascript files, both named jquery.js. You need to work out what is loading those two scripts and make sure that only one jQuery gets loaded, and it will have to be the ...


1

Ok so I found out what was wrong : it seems that WordPress adds empty p tags into your code. So I had one of those in my HTML and it was messing up the layout. To tell WordPress to stop doing that, you have to comment this line add_filter( 'the_content', 'wpautop' ); which is in default-filters.php in the wp-include directory at the root of your site. ...


1

I would be careful removing WordPress classes. Some plugins may depend on those classes. You should be able to pretty easily add your own classes though, as explained in the WordPress Codex. You'd use the nav_menu_css_class filter to alter or add those classes. See the Codex for an example of doing so. I don't know what classes twitter bootstrap wants or ...


1

For use in the admin, you need the admin_enqueue_scripts hook instead of wp_enqueue_scripts.


1

Read "Multiple Loops in Action at codex page" i think you´ll have your answer there...at least i had mine : http://codex.wordpress.org/The_Loop I did use one "featured" category. And the query was made by "Multiple loops in Action". First loop with just one post with the featured category to put the bootstrap carousel class active. Then the other loop put ...


1

Have you tried wp-sass https://github.com/sanchothefat/wp-sass? I haven't tried the latest version, but I got it working locally for testing with Foundation 4.


1

I haven't seen anything out there for that specific flavor of Bootstrap. If you want a Custom Bootstrap theme on Wordpress, and you don't want to code it from scratch, I would suggest downloading the WP-Bootstrap theme and a Bootstrap theme from a site like Bootswatch. You'll have to replace some css files, but that should get you pretty far. Hope that ...



Only top voted, non community-wiki answers of a minimum length are eligible