I am using a theme called "Venture" and created a child theme to edit the styling via CSS, however I am running into a bit of an issue. The navigation our client wants to use is available on top as part of the theme, as the main nav, but the footer menu/nav is a different styling altogether and seems to be wrapped by a PHP function or a widget, I can't really tell.
I want to to make it look like the one on top. However, no matter what I do in CSS it won't change, and I find that by adding more CSS code which is essentially already in the parent theme is redundant and unnecessary, since I can use them if coded correctly. How to solve this issue?
The site I am building is on a sub-domain on WP.
Ok so I figured out a great way to do this. Basically I created a footer.php file and added it to my child theme folder. I copied the code from the parent "footer.php" file and pasted to the Child version. Then I removed the guts of the menu where it inside of the It used to point to secondary menu, now it points to primary. Then I followed it up by styling with CSS. I renamed menu to menu_2 as follows:
<div class="menu_2">
<?php if (has_nav_menu( 'primary' )) {
wp_nav_menu( array(
'container' => 'menu',
'container_class' => '',
'menu_class' => 'dropdown',
'menu_id' => 'mainmenu',
'sort_column' => 'menu_order',
'theme_location' => 'primary'
));
} else {
echo '<p>Please set your Main navigation menu on the <strong>Appearance > Menus</strong> page.</p>';
} ?>
</div>
Related
I am using Asta Wordpress theme and its single page website with 4 menus. Now I have created 2 more pages but menu isn't working since it belong to homepage only. Is there any way I can set different menu for different pages?
usually all the pages follow page.php, have a look if you have header imported in page.php, if you want a different header menu, create a different header and rename as header-pages.php, assign a different menu here as
<?php wp_nav_menu(array(
'theme_location' => 'page_menu',
'container' => false,
'depth' => 3
))
?>
add this to your functions.php by editing the existing array
register_nav_menus( array(
-------remove this, add the below code only in existing array------
'page_menu' => esc_html__( 'Page Menu', 'website' )
-------remove this, add the above code only in existing array------
));
I am creating a single page wordpress site. The primary menu that is in header.php uses hash links to reference content in the page. All the content in the body of the webpage loads into page-home.php. One of the items in my primary menu however is Blog. Blog loads entirely different templates. Once you are in blog, the other menu items do not work because the hash links no longer have the content in the index.php templates to connect to. Should I conditionally load a separate menu for when the url is /blog/? Call a separate header on index.php?
No need for two header.php files. Inside your current header.php use this code
<?php
if(is_page('Home'){ //or whatever your home page is called
wp_nav_menu ( $arrayName = array( 'theme_location' => 'primary', 'container' => 'nav', 'container_class' => 'navbar-collapse collapse', 'menu_class' => 'nav navbar-nav navbar-right' ) );
} else{
//INSERT CODE FOR BLOG MENU
}
?>
I am trying to remove numbers from pagination links on a paginated Wordpress post to leave only next/previous buttons. I have the code as follows and it still does not work as required. If I set a display:none; css rule to the tags within the .paging p class this affects all links including the next/previous links as the links do not have a separate class to them.
<?php
wp_link_pages(array(
'before' => '<p class="paging" style="margin-bottom: 5em;">' . __(''),
'after' => '</p>',
'next_or_number' => 'next', # activate parameter overloading
'nextpagelink' => __('<span class="pagelink right">NEXT</span>'),
'previouspagelink' => __('<span class="pagelink left">PREVIOUS</span>'),
'pagelink' => '%',
'echo' => 1 )
); ?>
Here is an example of a post illustrating the problem: http://famtrav.staging.wpengine.com/destinations/uk/15-fun-things-july-2016/
Is there another way of me achieving the required result? I hope this makes sense. Many thanks.
I have now solved this. The problem was caused by conflicting code. Specifically the wp_link_pages function was being defined both in the themes functions.php file and in the post-template.php file within the /wp-includes/ folder with instructions in one incidence contradicting the other. I commented out the instructions in the functions.php file and altered the post-template.php file with the correct code and this solved the problem.
I am desperately trying to remove the bullets that appear in front of the flags. I am using WordPress and I've added this Polylang feature as a widget in my header. I tried to post a screenshot but I can't upload images yet.
I would also like to custom css this widget but I have tried everything I can think of and nothing is happening. Basically this is placed on the left side of my page when I want it on the right side. Here is the code I used in the my_functions php:
function my_widgets_init() {
) );register_sidebar( array(
'name' => __( 'Header Area', 'your-theme' ),
'id' => 'sidebar-2',
'description' => __( 'An optional widget area for your site header', 'your-theme' ),
'before_widget' => '<div id="%1$s" class="headwidget %2$s">',
'after_widget' => "</div>",
'before_title' => '<h3>',
'after_title' => '</h3>',) );
}
add_action( 'widgets_init', 'my_widgets_init' );
And here is the code used in header.php
<div class="span12" id="polylang-2">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar-2') ) : ?> <?php endif; ?></div>
I tried entering Custom CSS from the WP admin widgets panel, i have no idea how to code from here I guess cause nothing ever changes... I have already done a lot of customization to my site so I am ok with CSS, it's more finding where to make changes I have trouble with. And php is not my forte yet.
Thanks for all your help.
you can inject a custom class after widget class as shown in the code below:
'before_widget' => ''
now you can call the class myclass from style.css file present in your theme folder I hope you know how to remove the bullets in the css
you can locate your theme files from wp-content/themes/themename
.myclass {float:left;} /* to move it on the left */
.myclass ul {list-style:none;}
Moreover you dont require a div with the id polylang-2 since the div automatically comes from the above widget code.
and you can change the header.php code to
<?php dynamic_sidebar("sidebar-2");?>
OR
the next way around is if you want to use your existing code then add the following css in your style.css file inside your theme
#polylang-2 ul {list-style:none;}
Let me know if it solves your problem or not. Thanks
I am creating my wordpress theme with sub pages and their sub pages also, for this i create my own theme. now I manage these child pages from admin panel to show header navigation menu dropdown . but its not working , they show him in a line ,not drop down .so how can i show in dropdown in my header part.
my menu code is
<div class="nav">
<?php wp_nav_menu(array('menu' => 'topmenu', 'walker' => new description_walker(), 'menu_class' => 'nav', 'container' => false)); ?>
</div>
Its show 4 menu.
but I have sub pages in only 2 menu.
so how can i show that?
you are declaring twice ".nav" as a class, the first time you do it in here:
<div class="nav">
the second time you declare it in:
'topmenu', 'walker' => new description_walker(), 'menu_class' => 'nav', 'container' => false)); ?>
so basically you are asigning the class .nav both in the div and in the menu ul, which may create issues depending on yoru css.
I use this plugin for Dropdown menus: http://shailan.com/wordpress/plugins/dropdown-menu/ - it works perfectly and it has some nice effects you can use too, like a sliding down animation