Tag Info

Hot answers tagged

6

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

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') ); } ...


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: ...


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

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 ...


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

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' ); ...


3

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 ...


3

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 ...


3

There was a trac ticket requesting improvements to the function since it was inflexible, yet required for themes hosted in official repository. It had been resolved, adding much needed wp_link_pages and wp_link_pages_link filters, so now output can be cleanly modified without need to use custom function. I went through quite a few takes on this over years ...


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 use wp_deregister_style in your child theme. Like this. function remove_unwanted_css() { wp_dequeue_style( 'bootstrap' ); wp_deregister_style( 'bootstrap' ); wp_dequeue_style( 'bootstrap-custom' ); wp_deregister_style( 'bootstrap-custom' ); } add_action( 'wp_enqueue_scripts', 'remove_unwanted_css', 20 ); Similarly you can ...


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

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 ...


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

On a separate thread, I found out that it was indeed possible to customize the output of the Gallery Shortcode using some code in the functions.php. The code below would be a fairly standard version of the slider without captions. You'd obviously need to make sure you include Jquery and Bootstrap files as you would normally do using Bootstrap. // Remove ...


1

Your options are the following: Extend the walker and change the output (override start_el function) Here is an example of the Walker, assuming you are using this bootstrap walker. Usage: 'walker' => new se150102_bootstrap_walker() Walker: class se150102_bootstrap_walker extends wp_bootstrap_navwalker { /** * This walker is identical to ...


1

I answered earlier but the link I provided doesn't exist anymore. So, I'll post the code here in hopes that it is what you're looking for. In your functions.php, add this snippet to create the markup: /* Mobile Menu ----------------------------------------------------------------------------------------*/ add_action( 'genesis_site_description', ...


1

What about CSS3 columns? All new browser support it and you can make it beautifully degrade it on old browser. Moreover you can use media queries to make it responsive! http://www.w3schools.com/css/css3_multiple_columns.asp



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