I have a problem related to wordpress footer widget. I created 2 custom sidebar in my twenty-thirteen theme and I add 2-2 widgets in all sidebar to show in footer. But my all widget not coming one by one, it go left.
Please help Me.
here is image of foote and widget section:
https://lh3.googleusercontent.com/-4RKEDGwsARo/WZajbTJ60BI/AAAAAAAAAsw/VTNLuIVGHwcPr5TC0qQtp6Ctp05BiZUpQCL0BGAYYCw/h1080/2017-08-18.png
https://lh3.googleusercontent.com/-Uq98dM3YjX8/WZajeXt-H0I/AAAAAAAAAs0/0-9xxluW-mcwxmbRuXc8T-jVPcjojI5VQCL0BGAYYCw/h1080/2017-08-18.png
Here is my code:
Function.php
function twentythirteen_widgets_init() {
register_sidebar( array(
'name' => __( 'Main Widget Area', 'twentythirteen' ),
'id' => 'sidebar-1',
'description' => __( 'Appears in the footer section of the site.',
'twentythirteen' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
register_sidebar( array(
'name' => __( 'Secondary Widget Area', 'twentythirteen' ),
'id' => 'sidebar-2',
'description' => __( 'Appears on posts and pages in the sidebar.', 'twentythirteen' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
register_sidebar( array(
'name' => __( 'Footer 1', 'twentythirteen' ),
'id' => 'sidebar-3',
'description' => __( 'Appears on posts and pages in the sidebar.', 'twentythirteen' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
register_sidebar( array(
'name' => __( 'Footer 2', 'twentythirteen' ),
'id' => 'sidebar-4',
'description' => __( 'Appears on posts and pages in the sidebar.', 'twentythirteen' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
}
add_action( 'widgets_init', 'twentythirteen_widgets_init' );
sidebar-main
if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
<div id="secondary" class="animated fadeInUp sidebar-container" role="complementary">
<div class="widget-area">
<div class="container">
<div class="row">
<div class="col-md-3 col-sm-6 sidebar-1">
<?php dynamic_sidebar( 'sidebar-1' ); ?>
</div>
<div class="col-md-3 col-sm-6 sidebar-2">
<?php dynamic_sidebar( 'sidebar-2' ); ?>
</div>
<div class="col-md-3 col-sm-6 sidebar-3">
<?php dynamic_sidebar( 'sidebar-3' ); ?>
</div>
<div class="col-md-3 col-sm-6 sidebar-4">
<?php dynamic_sidebar( 'sidebar-4' ); ?>
</div>
</div>
</div>
</div><!-- .widget-area -->
</div><!-- #secondary -->
footer
<div class="site-info ">
<div class="container copyright">
<div class="row">
<div class="col-md-6">
<p class="pull-left">© 2017 SHOP</p>
</div>
<div class="col-md-6">
<?php do_action( 'twentythirteen_credits' ); ?>
<?php printf( __( 'Proudly powered by %s', 'twentythirteen' ), 'WordPress' ); ?>
</div>
</div>
</div>
</div><!-- .site-info -->
</footer><!-- #colophon -->
Related
I created two menus for my wordpress theme
One for desktop and other for mobile with this code:
function register_my_menus() {
register_nav_menus(
array(
'top-menu' => __( 'top Menu' ),
'footer-menu' => __( 'footer Menu' ),
'extra-menu' => __( 'Socials Menu' ),
'mobile-menu' => __( 'mobile Menu' ),
)
);
}
add_action( 'init', 'register_my_menus' );
i called this two codes in header.php:
menu in header:
<div class="mobile-menu"></div>
<ul class="menu">
<li class="page_item page-item-2">About</li>
<?php wp_nav_menu( array(
'theme_location' => 'top-menu',
));
?>
</div>
<div class="clear"></div>
<ul id="mobile-nav">
<?php
wp_nav_menu(array(
'theme_location' => 'mobile-menu',
));
?>
</ul>
<div class="clear"></div>
</div>
Result: mobile menu not shown
do you have a solution to display mobile menu ?
I'm trying to set different navigations in the footer on my wordpress page.
I've registered the different navs inside functions.php:
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'bootstrapcanvaswp' ),
'language' => __('Language Menu', 'bootstrapcanvaswp'),
'rassismus' => __('Footer Rassismus'),
'antisemitismus' => __('Footer Antisemitismus'),
'rassismusstrafnorm' => __('Footer Rassismusstrafnorm'),
'bildung' => __('Footer Bildung'),
'medien' => __('Footer Medien'),
'oeffentlichkeit' => __('Footer Öffentlichkeit'),
'gra' => __('Footer GRA'),
'meldetool' => __('Footer Meldetool')));
and inside my footer.php I've set the different navigations:
<div class="row seven-cols footer-nav">
<div class="col-md-1">
<?php
wp_nav_menu( array(
'menu' => 'rassismus',
'container' => 'div',
'container_class' => 'footer-nav-compl'
));
?>
</div>
<div class="col-md-1">
<?php
wp_nav_menu( array(
'menu' => 'antisemitismus',
'container' => 'div',
'container_class' => 'footer-nav-compl'
));
?>
</div>
<div class="col-md-1">
<?php
wp_nav_menu( array(
'menu' => 'rassismusstrafnorm',
'container' => 'div',
'container_class' => 'footer-nav-compl'
));
?>
</div>
<div class="col-md-1">
<?php
wp_nav_menu( array(
'menu' => 'bildung',
'container' => 'div',
'container_class' => 'footer-nav-compl'
));
?>
</div>
<div class="col-md-1">
<?php
wp_nav_menu( array(
'menu' => 'medien',
'container' => 'div',
'container_class' => 'footer-nav-compl'
));
?>
</div>
<div class="col-md-1">
<?php
wp_nav_menu( array(
'menu' => 'oeffentlichkeit',
'container' => 'div',
'container_class' => 'footer-nav-compl'
));
?>
</div>
<div class="col-md-1 last-item">
<?php
wp_nav_menu( array(
'menu' => 'gra',
'container' => 'div',
'container_class' => 'footer-nav-compl'
));
?>
<?php
wp_nav_menu( array(
'menu' => 'meldetool',
'container' => 'div',
'container_class' => 'footer-nav-compl'
));
?>
</div>
</div>
My problem is that some are working well an other not, they just display the nav of "Antisemitismus"
Working:
Antisemitismus
Rassismusstrafnorm
Bildung
Medien
Meldetool
GRA
Not working (displaying Antisemitismus)
Rassimus (first)
Oeffentlichkeit (second to last)
In the backend I've set all navigations to the right name and none of the navigations are empty...
Does anyone had a similar problem or knows something to help me?
Thank you very much
Use theme_location instead of name - name is reffering to the value of the array you send to register_nav_menus, not the key.
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>
I'm creating a one-page theme for WordPress. In my index.php I'm listing all pages underneath each other:
<?php $args = array(
'sort_order' => 'ASC',
'sort_column' => 'menu_order', //post_title
'hierarchical' => 1,
'exclude' => '',
'child_of' => 0,
'parent' => -1,
'exclude_tree' => '',
'number' => '',
'offset' => 0,
'post_type' => 'page',
'post_status' => 'publish'
);
$pages = get_pages($args);
//start loop
foreach ($pages as $page_data) {
$content = apply_filters('the_content', $page_data->post_content);
$title = $page_data->post_title;
$slug = $page_data->post_name;
?>
<div id='<?php echo "$slug" ?>' class="section">
<div id="inner-content" class="wrap cf">
<div id="main" class="m-all cf" role="main">
<div class="content">
<h2 class="section-title"><?php echo "$title" ?></h2>
<?php echo "$content" ?>
<?php the_post_thumbnail('full'); ?>
</div>
</div>
</div>
<?php } ?>
However, my thumbnail does not show up... There is no error message, but as well no thumb. Any ideas?
Try this code
<?php $args = array(
'sort_order' => 'ASC',
'sort_column' => 'menu_order', //post_title
'hierarchical' => 1,
'exclude' => '',
'child_of' => 0,
'parent' => -1,
'exclude_tree' => '',
'number' => '',
'offset' => 0,
'post_type' => 'page',
'post_status' => 'publish'
);
$pages = get_pages($args);
//start loop
foreach ($pages as $page_data) {
$content = apply_filters('the_content', $page_data->post_content);
$title = $page_data->post_title;
$slug = $page_data->post_name;
?>
<div id='<?php echo "$slug" ?>' class="section">
<div id="inner-content" class="wrap cf">
<div id="main" class="m-all cf" role="main">
<div class="content">
<h2 class="section-title"><?php echo "$title" ?></h2>
<?php echo "$content" ?>
<?php echo get_the_post_thumbnail( $page_data->ID, 'thumbnail' ); ?>
</div>
</div>
</div>
<?php } ?>
I have created a custom post type named "Training" & a Custom Taxonomy for the same named "Table Of Content"
I need to create a Page template to display Table Of Content Something like this
<div id="TableOfContents">
<ul class="sections">
<li> <a>Custom Taxonomy 1</a>
<ul class="sidenav">
<li class="selected"> Child Taxonomy 1
<ul class="items">
<li> Post Title 1 </li>
<li> Post Title 2 </li>
<li> Post Title 2 </li>
</ul>
</li>
<li class="selected"> Child Taxonomy 2
<ul class="items">
<li> Post Title 1 </li>
<li> Post Title 2 </li>
<li> Post Title 2 </li>
</ul>
</li>
</ul>
</li>
<li> <a>Custom Taxonomy 2</a>
<ul class="sidenav">
<li class="selected"> Child Taxonomy 1
<ul class="items">
<li> Post Title 1 </li>
<li> Post Title 2 </li>
<li> Post Title 2 </li>
</ul>
</li>
<li class="selected"> Child Taxonomy 2
<ul class="items">
<li> Post Title 1 </li>
<li> Post Title 2 </li>
<li> Post Title 2 </li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
Here is the php code in functions.php for creating custom taxonomy
// Custom Taxonomy for Training
$labels = array(
'name' => 'Table of Content',
'singular_name' => 'Table of Content',
'search_items' => 'Search Table of Content',
'popular_items' => 'Popular Table of Content',
'all_items' => 'All Table of Content',
'parent_item' => 'Parent Table of Content',
'edit_item' => 'Edit Table of Content',
'update_item' => 'Update Table of Content',
'add_new_item' => 'Add New Table of Content',
'new_item_name' => 'New Table of Content',
'separate_items_with_commas' => 'Separate Table of Content with commas',
'add_or_remove_items' => 'Add or remove Table of Content',
'choose_from_most_used' => 'Choose from most used Table of Content'
);
$args = array(
'label' => 'Table of Content',
'labels' => $labels,
'public' => true,
'hierarchical' => true,
'show_ui' => true,
'show_in_nav_menus' => true,
'args' => array( 'orderby' => 'term_order' ),
'rewrite' => array( 'slug' => 'table-of-content', 'with_front' => false ),
'query_var' => true
);
register_taxonomy( 'tableofcontent', 'training', $args );
Thanks & Regards
Here is the final code I managed to working out:
<div class="content" role="main">
<?php $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
echo '<h3 class="tax-title">' . $term->name . '</h3>';
?>
<div id="TableOfContents">
<div class="ui-boxmenu">
<ul class="sections">
<?php
$taxonomyName = "tableofcontent";
$parent_terms = get_terms($taxonomyName, array(
'parent' => $term->term_id,
'orderby' => 'menu_order',
'hide_empty' => false
));
foreach ($parent_terms as $pterm) {
//Get the Child terms
$terms = get_terms($taxonomyName, array(
'parent' => $term->term_id,
'orderby' => 'menu_order',
'hide_empty' => false
));
foreach ($terms as $term) {
echo '<li><a>' . $term->name . '</a>';
$childs = get_terms($taxonomyName, array(
'parent' => $term->term_id,
'orderby' => 'menu_order',
'hide_empty' => false
));
echo '<ul class="sidenav">';
foreach ($childs as $child) {
echo '<li>' . $child->name . '';
$wpq = array ('taxonomy'=>'tableofcontent','orderby' => 'menu_order','order' => 'ASC','term'=>$child->slug);
$myquery = new WP_Query ($wpq);
$article_count = $myquery->post_count;
if ($article_count) {
echo "<ul class=\"items\">";
while ($myquery->have_posts()) : $myquery->the_post();
echo "<li>".$post->post_title."</li>";
endwhile;
echo "</ul>";
}
echo '</li>';
}
echo '</ul>';
echo '</li>';
}
}
?>
</ul>
</div>
</div>
<script language="javascript">
$('.ui-boxmenu').boxmenu();
</script>
<script type="text/javascript">
// Default add class selected to First Item in Box Menu
jQuery(document).ready(function($) {
$("ul.sections li:first").addClass("selected");
$("ul.sections li:first .sidenav li:first").addClass("selected");
$("ul.sections li:first .sidenav li ul.items").addClass("selected");
$("ul.sections li:first .sidenav li ul.items li:first").addClass("selected");
});
</script>
<?php
$singleterm = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
$args = array(
'post_type' => 'training',
'tableofcontent' => $singleterm->slug,
'orderby' => 'menu_order',
'showposts' => 1,
'order' => 'ASC',
);
$posts = get_posts( $args );
foreach ($posts as $post) : setup_postdata($post);
?>
<h2 class="content-subhead"><?php the_title() ?></h2>
<?php the_content() ?>
<?php endforeach; wp_reset_postdata(); ?>
</div>
Regards