Home › Forums › Free Themes › Photo Perfect › Right Category Drop Down Menu
Tagged: categories, dropdown menu
- This topic has 4 replies, 2 voices, and was last updated 8 years, 10 months ago by wensolutions.
-
AuthorPosts
-
January 20, 2016 at 6:41 pm #952DelParticipant
How can I make a drop down below Category Menu on the website.. I did the one on the Menu drop down .but cant seem to do it on the right side drop down menu. in categories?
January 21, 2016 at 2:22 am #953wensolutionsKeymasterHello Del,
First make a Child Theme and activate it before you go making the following changes. You will have two new files functions.php and style.css .
After you are done with Child Theme set up copy and paste the following piece of PHP code in your functions.php file.
function photo_perfect_add_category_navigation(){ $show_category_dropdown = photo_perfect_get_option( 'show_category_dropdown' ); if ( true !== $show_category_dropdown ) { return; } ?> <div id="category-menu" class="clear-fix header-navigation"> <div class="container"> <button class="nav-list-btn"><i class="fa fa-list"></i><span><?php _e( 'Category', 'photo-perfect' ); ?></span></button> <div class="category-list-wrapper"> <ul> <?php wp_list_categories( 'title_li=&depth=2' ); ?> </ul> </div><!-- .category-list-wrapper --> </div><!-- .container --> </div><!-- #category-menu --> <?php }
Now put following line of CSS code in style.css file.
.header-navigation ul .toggled-on { display: block; } button, input[type="button"]:focus, input[type="reset"]:focus, input[type="submit"]:focus, .comment-reply-link:focus{ outline: none !important; }
This should do the trick appearing the sub-menu categories as dropdown like the one in main Menu.
January 21, 2016 at 1:56 pm #957DelParticipantParse error: syntax error, unexpected ‘if’ (T_IF) in /home1/xxxxxx/public_html/xxxxxxx.com/wp-content/themes/child-theme/functions.php on line 18
January 21, 2016 at 1:57 pm #958DelParticipanterrors came up
January 21, 2016 at 9:06 pm #965wensolutionsKeymasterYour entire functions.php code with above custom code should be look like this.
<?php /** * Child Theme functions and definitions * */ /** * Loading Parent theme stylesheet * */ add_action( 'wp_enqueue_scripts', 'photoperfect_child_enqueue_styles' ); function photoperfect_child_enqueue_styles() { wp_enqueue_style( 'photoperfect-parent-style', get_template_directory_uri() . '/style.css' ); } function photo_perfect_add_category_navigation(){ $show_category_dropdown = photo_perfect_get_option( 'show_category_dropdown' ); if ( true !== $show_category_dropdown ) { return; } ?> <div id="category-menu" class="clear-fix header-navigation"> <div class="container"> <button class="nav-list-btn"><i class="fa fa-list"></i><span><?php _e( 'Category', 'photo-perfect' ); ?></span></button> <div class="category-list-wrapper"> <ul> <?php wp_list_categories( 'title_li=&depth=2' ); ?> </ul> </div><!-- .category-list-wrapper --> </div><!-- .container --> </div><!-- #category-menu --> <?php }
-
AuthorPosts
- You must be logged in to reply to this topic.