WP nav menu + Bootstrap, add role=”menu” to UL

[Update] Solution found: I was looking for ‘items_wrap’ => ‘<ul id=”%1$s” class=”%2$s” role=”menu” >%3$s</ul>’ <?php wp_nav_menu( array( ‘menu’ => ‘menu’, ‘theme_location’ => ‘menu’, ‘items_wrap’ => ‘<ul id=”%1$s” class=”%2$s” role=”menu” >%3$s</ul>’, ‘depth’ => 0, ‘container’ => ”, ‘menu_class’ => ‘dropdown-menu’, ‘fallback_cb’ => ‘wp_bootstrap_navwalker::fallback’, ‘walker’ => new wp_bootstrap_navwalker()) ); ?>

Check for Twitter Bootstrap Loaded

There is no good way of doing this. One way is to enumerate the already registered scripts, like this: function yourplugin_add_my_stylesheet() { global $wp_styles; if ( $wp_styles instanceof WP_Styles ) { // enumerate all current styles foreach( $wp_styles->queue as $handle ) { // use the $handle to see if it’s called ‘bootstrap’ $obj = $wp_styles->registered[$handle]; … Read more

Different column width in 2 rows with bootstrap and custom post types-different classes needed

Try the code below. <div class=”container-fluid gray-section”> <div class=”container”> <div class=”row”> <?php $projects = get_posts(array(‘post_type’=>’project’,’posts_per_page’=>5, ‘order’=>’ASC’)); if ($projects) { ?> <ul class=”list-unstyled”> <?php $i = 0; ?> <?php foreach ($projects as $post) { setup_postdata( $post ) ?> <?php if($i % 3 == 1) { ?> <li class=”col-md-4 col-sm-6 col-xs-12 col-xxs-12 text-center “> <?php } else … Read more

How to implement CSS-defined images from bootstrap site in wordpress theme

Multiple solutions for defining the images -> Post Thumbnails While creating a new post, you can set the Featured Image which will automatically set the post image. Since your image is full width, you need to set the size of the thumbnail using: https://codex.wordpress.org/Function_Reference/the_post_thumbnail Media Upload Go to Media -> Add New. Upload your image … Read more

Is there a way to multiply archive loop results sequentially?

<?php $counter = 1; if(have_posts()) : while(have_posts()) : the_post(); ?> <?php if($counter == 1) : ?> <div class=”row clear” style=”margin-bottom:0px;”> <div class=”col-md-12 border-12″> <a class=”thumb” href=”https://wordpress.stackexchange.com/questions/202991/<?php the_permalink(); ?>” title=”<?php the_title_attribute(); ?>”><?php the_post_thumbnail(‘category-thumbnail’); ?></a> <div class=”blog-details-wrapper clear”> <h2 class=”title”> <a href=”https://wordpress.stackexchange.com/questions/202991/<?php the_permalink(); ?>” title=”<?php the_title(); ?>”><?php the_title(); ?></a> </h2> <span class=”date”><?php the_time(‘F j, Y’); ?> <?php … Read more

Get the featured image url of clicked post

It seems you are using this outside the loop then use get_the_post_thumbnail to get the featured image for any post by supplying post id. So your code will become this. <?php if ( has_post_thumbnail() ) { echo ‘<a href=”‘ . get_permalink( $post->ID ) . ‘” >’; echo get_the_post_thumbnail( $post->ID, ‘my_feature_image’, array( ‘class’ => “someName” ) … Read more

Shortcode arguments to another shortcode

You could pass the variable via a global but it would be neater to trap it in a static variable: function track_acc_id($new_id = false) { static $id; if (!empty($new_id)) { $id = $new_id; } return $id; } //This is the accordion container function accordionGroup( $atts, $content = null ) { extract(shortcode_atts(array( ‘id_container’ => ”, ), … Read more