Im trying to get the col-md-6 to stack below the col-md-4 on mobile but cant get it to work. Any advice how to achieve this would be great.
<footer>
<div class="container">
<div class="row">
<div class="col-md-6 col-md-offset-1 col-xs-12">
<?php
wp_nav_menu( array(
'menu' => 'footer',
'theme_location' => 'footer',
'depth' => 1,
'container' => 'div',
'container_id' => 'footer-nav',
'menu_class' => 'nav navbar-nav',
'fallback_cb' => 'wp_bootstrap_navwalker::fallback',
'walker' => new wp_bootstrap_navwalker())
);
?>
</div>
<div class="col-md-4 col-xs-12 copyright-text">
<p>Copyright © <?php echo date("Y"); ?> Elliott Davidson. All Rights Reserved.</p>
</div>
</div>
</div>
You could look into using order property from utilizing flexbox. Check out the documentation here.
What you'd do is something like this:
<div class="container">
<div class="row flex">
<div class="col-md-6 col-md-offset-1 col-xs-12 first">Div 1</div>
<div class="col-md-4 col-xs-12 copyright-text second">Div2</div>
</div>
</div>
/* Make sure to use all the proper prefixers */
/* Allow this to be up to mobile of 767px */
#media all and ( max-width: 767px ) {
.flex { display: flex; }
.first { order: 2; }
.second { order: 1; }
}
Take a look at this codepen which will have a solution for you.
Switch the order of the columns (mobile first) and then use Bootstrap's column ordering:
<div class="row">
<div class="col-md-4 col-md-push-6 col-md-offset-1 col-xs-12 copyright-text">
<p>Copyright © <?php echo date("Y"); ?> Elliott Davidson. All Rights Reserved.</p>
</div>
<div class="col-md-6 col-md-pull-4 col-xs-12">
<?php
wp_nav_menu( array(
'menu' => 'footer',
'theme_location' => 'footer',
'depth' => 1,
'container' => 'div',
'container_id' => 'footer-nav',
'menu_class' => 'nav navbar-nav',
'fallback_cb' => 'wp_bootstrap_navwalker::fallback',
'walker' => new wp_bootstrap_navwalker())
);
?>
</div>
</div>
Bootply example
You could do that with flex box. Add a
class like this
<div class="row flexible"></div>
Css
#media (max-width:480px){
.flexible{
display:flex;
}
.flexible div:nth-child(1){
order:1;
}
.flexible div:nth-child(2){
order:2;
}
}
I managed to find a solution by adding a class to the col-md-6 and floating it right.
<div class="container">
<div class="row">
<div class="col-md-6 col-md-offset-1 col-xs-12 footer-nav">
<?php
wp_nav_menu( array(
'menu' => 'footer',
'theme_location' => 'footer',
'depth' => 1,
'container' => 'div',
'container_id' => 'footer-nav',
'menu_class' => 'nav navbar-nav',
'fallback_cb' => 'wp_bootstrap_navwalker::fallback',
'walker' => new wp_bootstrap_navwalker())
);
?>
</div>
<div class="col-md-4 col-xs-12 copyright-text">
<p>Copyright © <?php echo date("Y"); ?> Elliott Davidson. All Rights Reserved.</p>
</div>
</div>
</div>
.footer-nav
float: right
Related
So, I have this page attached and have currently got a list outputting each Term where a post is contained in a particular term.
To do this I have a custom post type called 'episodes'
I have a custom Taxonomy called 'episode_categories'
and inside this I have various terms such as VR, Mixed Martial Arts and so on.
What I want to do is show a count of each term that has X amount of posts in it.
I currently have this as my code.
<div class="placeholder-main relative py-64 md:py-56 min-h-screen flex">
<div class="main my-auto w-full flex:none">
<div class="section">
<div class="container">
<div class="categories flex flex-wrap xs:block">
<?php
$args = array(
'type' => 'episodes',
'post_status' => 'publish',
'child_of' => 0,
'parent' => '',
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => 1,
'hierarchical' => 1,
'taxonomy' => 'episode_categories',
'pad_counts' => false
);
$categories = get_categories($args);
?>
<?php foreach ($categories as $category) : ?>
<div class="categories__item w-1/2 xs:w-full pr-5 xs:p-0 mt-10 xs:mt-6">
<div class="article text-2xl sm:text-xl xxs:text-base">
<h2 class="text-4xl sm:text-28px xxs:text-xl font-bold leading-none"><?php echo $category->name; ?></h2>
<p>There are
<strong>
0
</strong> podcasts in this category
</p>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
</div>
By default, the function get_categories returns the number of posts each category are associated to. You can access this value through category_count. Here is the code :
<p>
<strong>
<?= $category->category_count; ?>
</strong>
</p>
Tested and works
Wordpress menu is adding several additiom and empty a tags (exacly two)
if (has_nav_menu('secondary')) :
?>
<nav id="menu-secondary-title" class="nav-anchors">
<div class="wrap">
<a id="menu-secondary-anchor" class="menu-secondary-anchor" title="<?php _e('Secondary Mobile Menu', 'path'); ?>" href="#menu-secondary-mobile"><?php //_e( 'Check Us Out!', 'path' ); ?></a>
<div id="mobile-menu-secondary">
<img src="<?php echo get_template_directory_uri(); ?>/images/Hamburger_icon.svg.png"
<?php wp_nav_menu(array('theme_location' => 'secondary', 'container_class' => 'menu-secondary-mobile-top', 'menu_class' => '', 'menu_id' => 'menu-secondary-items', 'fallback_cb' => '')); ?>
</div>
</div><!-- .wrap -->
</nav><!-- #menu-secondary-title -->
<nav id="menu-secondary" class="menu-container">
<div class="wrap clr">
<?php wp_nav_menu(array('theme_location' => 'secondary', 'container_class' => 'menu', 'menu_class' => '', 'menu_id' => 'menu-secondary-items', 'fallback_cb' => '')); ?>
</div><!-- .wrap -->
</nav><!-- #menu-secondary .menu-container -->
<?php endif; ?>
Please, help me find where could be something wrong. Which which next wordpress file can I explore, to find where is problem?
I am using sheadawson/silverstripe-blocks module: https://github.com/sheadawson/silverstripe-blocks
I am trying to have it so the user can add 2x images to a block. For some reason it will only pull through the first image.
Both of them are definitely uploaded as per the screenshot:
TwoImagesLeftTextRightBlock.php
<?php
class TwoImagesLeftTextRightBlock extends Block {
private static $db = array(
'Title' => 'Varchar(255)',
'Summary' => 'HTMLText',
);
private static $has_one = array(
'Image' => 'Image',
'SecondImage' => 'Image'
);
}
Template for the block:
<div class="container-fluid">
<div class="container">
<div class="row">
<div class="col-md-10 col-md-offset-1 ptb50">
<div class="col-md-8">
<div class="block-right-title">$Title</div>
<div class="block-left-text">
$Summary
</div>
</div>
<div class="col-md-4">
<img class="block-icon" src="$Image.URL" alt="">
<img class="block-icon" src="$SecondImage.URL" alt="">
</div>
</div>
</div>
</div>
</div>
Inspecting the code you can see it only pulls through the first image... Any ideas on how to get both working?
what i want to achieved is this
<div class="someclass"> // in place of <ul>
<a class="item">Page Title</a>
<a class="item">Page Title</a>
<a class="item">Page Title</a>
.
.
.
</div>
This is the patter which is used by semantic UI for horizontal menu
I have achieved this much
<div class="ui secondary menu">
Services
Portfolio
Shop
</div>
by using code
<div class="ui secondary menu">
<?php
$menuParameters = array(
'menu' => 'top-menu',
'container' => false,
'echo' => false,
'items_wrap' => '%3$s',
'depth' => 0,
);
echo strip_tags(wp_nav_menu( $menuParameters ), '<a>' );
?>
</div>
But i want to add
class="item"
to
Services
Please guide..
thankx
Finally I able to do this..
<div id="menu1" class="ui secondary menu">
<?php
$menuParameters = array(
'menu' => 'top-menu',
'menu_class' => 'item',
'container' => false,
'echo' => false,
'items_wrap' => '%3$s',
'depth' => 0,
);
echo strip_tags(wp_nav_menu( $menuParameters ), '<a>' );
?>
</div>
<script>
jQuery( "#menu1 a" ).addClass( "item" );
</script>
You can use 'menu_class'=> 'item'
Example:
<div class="ui secondary menu">
<?php
$menuParameters = array(
'menu' => 'top-menu',
'menu_class' => 'item',
'container' => false,
'echo' => false,
'items_wrap' => '%3$s',
'depth' => 0,
);
echo strip_tags(wp_nav_menu( $menuParameters ), '<a>' );
?>
</div>
Read the codex about function wp_nav_menu, you're using it wrong, do something like this:
echo strip_tags(wp_nav_menu(
'items_wrap' => '<div id="%1$s" class="%2$s">%3$s</div>',
'menu_class' => 'myclass ui',
'echo' => false,
), '<a>');
In wordpress admin > appereance > menus, you can define classes for each link. Just make sure you've turned it on at the screen options.
But you can also do something like this to add a class.
Thankx Fermolina for your answer unfortunately it give me this output which dosent work
Code use
<div class="ui secondary menu">
<?php
$menuParameters = array(
'menu' => 'test-menu',
'menu_class' => 'item',
'container' => false,
'echo' => false,
'items_wrap' => '%3$s',
'depth' => 0,
);
echo strip_tags(wp_nav_menu( $menuParameters ), '<a>' );
?>
</div>
OUTPUT no class in
<div class="ui secondary menu">
Home
</div>
Okay, so will confess to being completely new at this. I am a designer, first and foremost and trying to learn how to code by dismantling pre-built templates and studying them.
What I want to do is - have a short line of text (left float), a centered logo (whose width / height may vary upon finalization), and a text nav (right float). I am modifying a theme.
Here is what I have:
<header id="header" class="wrapper<?php if (get_option($prefix.'_width') == "width_full") { ?>_full<?php } ?>">
<div class="header_top clearfix">
<div id="logo" class="left_float">
<a class="logotype" href="index.php"><img src="<?php echo get_option($prefix.'_logo', 'images/logo.png'); ?>" alt="Logotype"></a>
</div>
<?php if(function_exists('wp_nav_menu')) : ?>
<?php
wp_nav_menu(
array(
'theme_location' => 'primary-menu',
'container' => 'nav',
'container_id' => 'nav',
'container_class' => 'right_float',
'menu_class' => '',
'menu_id' => '' ,
'walker' => new custom_menu_output()
));
?>
<?php else: ?>
<nav id="nav" class="right_float">
<ul>
<?php wp_list_pages('title_li=&depth=0'); ?>
</ul>
</nav>
<?php endif; ?>
</div>
Below is the CSS. I've tried to interchange the .left_float with the .center class as a test, but it ends up pushing the nav downwards.
.left_float {
float: left;
}
.center {
display: block;
margin-left: auto;
margin-right: auto }
.right_float {
float: right;
}
Long post - sorry! Any help would be appreciated - even some links where I can read and learn and get started on my own.
Thanks a bunch!
Part 1: First of all, there is no <div> with class center in your code. Start off by putting all of your code that's between the left_float and right_float <div> tags into its own <div class="center">...</div> tag. I'm assuming you want something like:
<header id="header" class="wrapper<?php if (get_option($prefix.'_width') == "width_full") { ?>_full<?php } ?>">
<div class="header_top clearfix">
<div id="logo" class="left_float">
<a class="logotype" href="index.php"><img src="<?php echo get_option($prefix.'_logo', 'images/logo.png'); ?>" alt="Logotype"></a>
</div>
<div class="center">
<?php if(function_exists('wp_nav_menu')) : ?>
<?php
wp_nav_menu(
array(
'theme_location' => 'primary-menu',
'container' => 'nav',
'container_id' => 'nav',
'container_class' => 'right_float',
'menu_class' => '',
'menu_id' => '' ,
'walker' => new custom_menu_output()
));
?>
<?php else: ?>
</div>
<nav id="nav" class="right_float">
<ul>
<?php wp_list_pages('title_li=&depth=0'); ?>
</ul>
</nav>
<?php endif; ?>
</div>
<br clear="all" />
You'll notice I added <div class="center">...</div> and added <br clear="all" /> (which is important for the next part...)
Part 2: Change your CSS to:
.left_float, .center, .right_float {
float: left;
}
But make sure you keep the new <br clear="all" /> in your code! With that at the end, you can float all divs to the left, and they will all be beside each other. From there, you can modify the width of each of the divs to whatever you'd like!
Well, I hope that helps,
Hope4You
Your wp_nav_menu is without any div. Enclose is withing a div and add just a single class class=lfloat to all the three divs.
`.lfloat{
float: left;
}`