WordPress.org

Forums

[resolved] Adding menu buttons in Lightword (15 posts)

  1. wheatonpub
    Member
    Posted 5 years ago #

    Hi All,

    I am the editor of a very poor college journal, and I've been forced to take over webmaster duties because of our lack of funds. I'm an English major with a simple understanding of HTML and CSS, so I've found it difficult to track down and change things with the lightword theme.

    All I want to do is be able to add more buttons to the header at the top (like the "home" and "about" buttons). And erase the "subscribe via" rss text (I edited the headertop.jpg to take the orange image out). I've looked through the various.php files, and I think I've located the important lines in the header.php file (of the lightword folder):

    <div id="top_bar">
    <ul id="front_menu"<?php echo lw_expmenu(); ?>>
    <?php echo lw_homebtn(__('Home','lightword')); ?>
    <?php echo lw_wp_list_pages();  ?>
    </ul>
    <?php echo lw_searchbox(); ?>
    </div>

    My question is, how do I add more buttons, and how do I link those buttons to posts I've created or outside pages?
    If i could edit the HTML of the first page, I could just add another item to the list, but I don't know how to do it with PHP files without screwing things up. Also, if you have any links to sites dealing php that would be fantastic.

    Your help is much appreciated.

    Nick

  2. If you want to add a static page into your top navigation menu could do something along these lines:

    <div id="top_bar">
    <ul id="front_menu"<?php echo lw_expmenu(); ?>>
    <?php echo lw_homebtn(__('Home','lightword')); ?>
    <li><a href="url-to-your-static-page-goes-here">Static Page</a></li>
    <?php echo lw_wp_list_pages();  ?>
    </ul>
    <?php echo lw_searchbox(); ?>
    </div>

    Otherwise (from a cursory review of the theme), check your options to see if you are using pages or categories as your navigation items. You may be expecting one and using the other.

    You might also consider visiting the theme web site and leaving a question/comment ...

    ... hope that helps some.

  3. trejder
    Member
    Posted 5 years ago #

    Hi,

    Go to Themes settings and select LightWord Settings from there. You'll find most option for what you need (disable RSS, top logo) there as this is very customisable theme!

    If you wish to add more pages on front many you DON'T HAVE TO dig through PHP files! Simply, in your WordPress, add some PAGES (NOT post) and see in above mentioned LightWord configuration, if you have set to show pages instead of categories on front menu (this is default setting so there should be any problems with that).

    You can even have submenu of front menu. Simply, while adding page select under which page current page will be placed.

    You are welcome to catch me via e-mail (which would be my nick - that is trejder - in domain tlen.pl), as I read this forum not to often. I will be happy to help you, if I only be able to and find some time for that! :)

    Regards,
    Trejder

  4. wheatonpub
    Member
    Posted 5 years ago #

    Much to my chagrin, I figured out that just adding pages added nav item menus. But your code will be useful, since I want to have my static page be called something different than "home".
    Thanks Cais and Tredjer, that was most helpful!

  5. warriorgateway
    Member
    Posted 5 years ago #

    Does anyone know how you would go about having both pages and categories in the top nav menu?

    Thanks!
    Chris

  6. Depending on what you have in mind ...

    If you are looking for something along the lines of:

    page || page || category || page || category || category || page || etc.

    I would suspect that to be quite involved and a major edit of the theme.

    Something such as:

    page || page || page || ...
    category || category || category || ...
    ... or vice-versa ...

    This would be much more easily introduced but would still require minor theme edits (possibly major edits).

  7. cynvela.
    Member
    Posted 5 years ago #

    I was able to suppress the pages (I hate having ALL my pages listed in the top nav bar of any of my sites), and added buttons to the top by adding:

  8. blah-blah-blah....

    BUT the buttons look slightly wonky. The text isn't centered on the button, and the color is slightly different. I think it looks "cheap."

    Anyone know how to fix the alignment (it's a matter of top-to-bottom centering, not left-to-right) and color?

  • cynvela.
    Member
    Posted 5 years ago #

    My mistake... that "blah blah blah" should have read:

    '

  • ' '' LINK '' '
  • '

  • ecommerce
    Member
    Posted 5 years ago #

    I wanted a similar feature for Lightword Top-bar Front-Menu to include both Pages and Categories and did it by adding the following three lines of code as outlined below, and some styling changes which I am not posting, since everyone has different CSS preferences:

    Where:

    in lightword/functions.php
    after function lw_wp_list_pages(){
    before 2nd return $top_list;

    You must leave your WP Admin -> Appearance -> Lightword Settings -> "Show categories on front menu" checkbox unchecked. Of course you could recode this to work the other way around, but that would not necessarily serve a purpose, as you can reorganize within the second block (i.e. after else) if needed.

    What:

    $top_listC = wp_list_categories("echo=0&depth=2&title_li=&exclude=".$lw_exclude_categories."");
    $top_listC = str_replace(array('">','</a>','<span><a','current-cat"><a'),array('"><span>','</span></a>','<a','"><a class="s"'), $top_listC);
    $top_list .= '<li class="page-item"><a href="" onClick="javascript: void();" ><span>By Category</span></a><ul>' . $top_listC . '</ul></li>';

    In my case, I have far less pages than categories, and have included all categories in a "By Category" top-level container. You may simple use the following lien instead of the third one above to have your top-level categories listed on their own outside of the "By Category" container, even though this would create usability issues in most cases due to pages andcategories being mixed, so take utmost care and do some usability testing to make sure the logical navigation structure makes sense.

    $top_list .= $top_listC;

    And last, do this at your own risk with a lot of testing!!! and remember to modify the necessary CSS in lightword/style.css -> /* FRONT MENU */. As an example you can add:

    #front_menu ul ul {border-top: 1px #ACACAB solid;}
    For adding a top-border to sub-menu fly-outs.

    #front_menu li ul ul {left: 3em;}
    To push sum-menu fly-outs further to the right in order to allow for easier navigation between items on the main drop-down.

    You can see it on Managing E-commerce Blog where we plan to add some type of a "by Tag" menu to the top-bar front-menu as well.

  • Roberto
    Member
    Posted 5 years ago #

    I add <li><a href="forum">Forum</a></li> in header, after <?php echo lw_homebtn(__('Pońćetna','lightword')); ?>, but is not in center ... look here. Whats wrong?

  • jzlee2002
    Member
    Posted 5 years ago #

    mojportal
    try:
    <li><a class="s" title="title" href="your-link"><span>your name</span></a></li>

  • cengizulusahin
    Member
    Posted 5 years ago #

    Hi ecommerce,

    Your suggestion worked fine...

    However, is there any way of modifying this code so that only one of the categories display instead of all.

    I don't need to display all.

    Oh by the way I removed the top-level container.

    Thanks

  • bertarecchia
    Member
    Posted 4 years ago #

    Hi, this is what i was looking for and it works. Thanks.
    The only problem is the the new button has that darker color of the current page, even if it's not the current page. Any idea how to fix it?

    you can view it here:

    http://www.anticoelements.com

  • skyblogz
    Member
    Posted 4 years ago #

    tried Ecommerce's suggestion and it works fine for me..

    thanks a lot man.

  • bertarecchia
    Member
    Posted 4 years ago #

    skyblogz, don't you have the same problem with the button being darker?

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags