Community Forums › Forums › Archived Forums › Design Tips and Tricks › How to add menu locations to Prose Theme
- This topic has 2 replies, 2 voices, and was last updated 9 years, 11 months ago by peoplespaces.
-
AuthorPosts
-
March 23, 2013 at 10:37 pm #30825TheronMember
Hello. Never written PHP or used Genesis before. So I hope to learn if I am on the right track, adding menu locations to the Prose Theme.
I'm trying to add third and fourth menu locations to the Prose Theme. If I understand correctly, to customize Genesis themes other than Prose, you'd edit functions.php. But to customize Prose, you add your custom PHP to the appropriate box in the backend.
I did that, and created two navmenu PHP files, according to the instructions in this article:
http://journalxtra.com/easyguides/add-menu-genesis-themes-4830/
Here are the two files' contents:
customnavone.php
<?php echo '<div id="nav"><div class="wrap">'; wp_nav_menu( array( 'sort_column' => 'menu_order','container_id' => 'customnavone' , 'menu_class' => 'menu customnavone superfish sf-js-enabled',
'theme_location' => 'customnavone') ); echo '</div></div>'; ?>
customnavetwo.php
<?php echo '<div id="nav"><div class="wrap">'; wp_nav_menu( array( 'sort_column' => 'menu_order','container_id' => 'customnavtwo' , 'menu_class' => 'menu customnavtwo superfish sf-js-enabled',
'theme_location' => 'customnavtwo') ); echo '</div></div>'; ?>
The two navmenu.PHP files were placed in the Prose Theme root directory. (Maybe Prose uses another directory?) I placed the custom PHP that would have gone into functions.PHP into the Custom PHP box in the Prose backend. Here it is:
<?php
/** Do not remove this line. Edit functions below. */
// Remove Custom Menu support
remove_theme_support ( 'genesis-menus' );// Default Menus: registers menus
add_theme_support ( 'genesis-menus' , array ( 'primary' => 'Primary Navigation Menu' , 'secondary' => 'Secondary Navigation Menu' , 'customnavone' => 'Third Navigation Menu', 'customnavtwo' => 'Fourth Navigation Menu' ) );// Add new navbar
add_action('genesis_before_content', 'customnavone');
function customnavone() {
require(CHILD_DIR.'/customnavone.php');
}// Add new navbar
add_action('genesis_after_content', 'customnavtwo');
function customnavtwo() {
require(CHILD_DIR.'/customnavtwo.php');
}I also put custom CSS for navmenuone into the Custom CSS box, but it was not used:
<style type="text/css">
.customnavone {background-color: white}
</style>
Both menus appear on my page in the locations I specified in the custom functions, in the Before Content and After Content locations. But the Menu Page in the backend does not list the Third and Fourth menu locations, nor let me choose what menus to put into them. Both menus simply list all the pages on the site. The CSS for navmenuone did not have any effect.What puts the additional positions into the Menu Page in the backend? I understood it to be the removal and re-registration part of the PHP above. Per below I wonder if it is being read.
In a How-To I used to create a custom Home Page for Prose, the author said his Custom PHP was not used, so he put it into a Must Use Plugin. That worked for me. (Here's the article: http://wpconnected.com/genesis-custom-home-page/). So maybe the Custom PHP is not being read?
Thanks for any help. I like Genesis and Studiopress a lot so far. The designs are beautiful. This is the first time I have been unable to answer a question by searching and using the documentation.
March 24, 2013 at 4:45 pm #30983TheronMemberWell, I fixed it! I tried putting the PHP code into a plugin in the Must-Use plugins directory I created. And it worked! My customized Prose Theme now has four menu positions.
I guess either the Custom PHP panel insertions are not always interpreted, or there's something else I don't know about. I also inserted code to remove the post byline from one category, and it worked.
May 28, 2014 at 9:58 am #107119peoplespacesMemberCould you please expand on this fix?
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.