Tag Info

Hot answers tagged

7

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


5

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


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

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


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

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

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

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


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

You can make use of featured images as suggested by @gmazzap in comments. This featured image will not be included in post content. However, if you already have your images included in post content, then you need to strip the post content down in two parts, as you've said in your question. I have two functions, one that returns all the images (or any html ...


2

Try using the count variable to increment the loop. <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true"> <?php if(get_field('faq_general_ht')): ?> <?php $count=0; ?> <?php while(has_sub_field('faq_general_ht')): ?> <div class="panel panel-default"> ...


2

As far as I've seen you're missing bootstrap CSS grid markup inside your page div, so to start add container class to page div and below that a .row element, for more inforamation on how the Bootstrap grid works check documantation and remember that all Js and styles are based on the correct markup selectors_


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

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


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

The best way to include bootstrap in your theme is to enqueue bootstrap css and js in your functions.php file. This is how you can enqueue bootstrap css and js from CDN hosted version. function my_scripts_enqueue() { wp_register_script( 'bootstrap-js', '://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js', array('jquery'), NULL, true ); ...


2

How to prevent the WordPress admin bar from overlapping with your Twitter Bootstrap navigation bar. In response to: WordPress admin bar overlapping twitter bootstrap navigation Asked by: @TheWebs If you are using Twitter Bootstrap with WordPress and have an issue with the WordPress admin bar overlapping with your navigation bar, you're probably pretty ...


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



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